Solved

Error Handling.....

Posted on 2000-05-18
6
164 Views
Last Modified: 2010-05-02
Hi dudes,

    I've got a big Excel app calling middle tier Dlls firing services on an Oracle DB. It's about time the error handling was sorted out. Not having written an error handler in VB before, I'm calling on you guys to sort me out with some code!

    The Error Handler is going to sit server side as a DLL and write errors to a centralised error log. This part I can do fine. I basically need to look at some existing Error Handlers to stop me making mistakes that have already been made. If anyone can help me out, I'd appreciate it.

Cheers, Nik.
0
Comment
Question by:NikWhitfield
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 

Expert Comment

by:CodeCommando
ID: 2821668
This is for a vb app, correct?

Here's what I've used and it has consistently worked for me.

In your function or sub, the very first line is this:

On Error Goto ErrorHandler

Then you write your code here.

Then you have two sub sections:

StandardExit:
  On Error Resume Next
  Exit Function

ErrorHandler:
  Do all your error trapping and logging here.

  Goto StandardExit

The StandardExit allows for a consistent way out of the function. If you have to close files, etc. , you do it there.




0
 

Author Comment

by:NikWhitfield
ID: 2821844
Sorry - I didn't explain correctly. I know how to implement error handling in code, but have not yet written an Error Handling Dll to sit server side and handle errors sent after the ErrorHandler: label.
0
 
LVL 38

Expert Comment

by:PaulHews
ID: 2822568
So you are wondering what kind of info to log?

Module name : Sub/Function name : Time/Date : Details of error and optionally variable dump.

You may want to pass the name of the application to the error handler and setup a separate directory for individual apps; decide on a file naming scheme; determine if you want one monolithic file, or break them down by day, week, month etc.

If you are using text files, make them easy to read.  You may be planning to take the error logs and design some kind of error-reading program, in which case you will want to use an easy to parse scheme or even use some kind of database.

Don't know if any of this helps, but it's just off the top of my head.

0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 5

Accepted Solution

by:
AnswerTheMan earned 100 total points
ID: 2823541
i get the impression that you are aiming to the error handling architecture.
if that's correct - it can be made in many ways. it depends how much time you want to invest in developing it.
i once wrote a very sophisticated DLL that was meant to be a central error handler for a server side application,
including tracking errors on clients, storing all in very neat dB, which even had triggers that fired events when same error was reported more then X times, depending on clients groups... etc...
the outcome was that that DLL was almost larger project then the main project, and have to be error haneled itself........
so you see... the sky is the limit...
it all depends on the importance you see it.
during the years, i've learned to find the golden way, which is always somewhere in the middle.
i've learned that the avarage user ALWAYS blames him\herself for errors..so, prompting him/her with a nice looking form making him/her blame him/herself more...is a good way. along with that - a log file is a MUST if you want to improve the code, and upgrade it.
0
 

Author Comment

by:NikWhitfield
ID: 2824755
It really is a pain in the rear, this error stuff! I've now set up a centralised log, logging VB and ADO errors. Client side, I will implement an error presentation routine. Now I just need to go through the few hundred subs and procedures and fill in the error handling code! Fun....
0
 
LVL 5

Expert Comment

by:AnswerTheMan
ID: 2827032
tnx. no need to go throught all subs and functions.
concentrate only where database action and HD\files actions are handeled. those are the most sensetive places.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Determine Range to Select 5 64
Excel VBA, find a string in a column, update a cell 7 118
Copy a range from 1..n excel sheets to one destination sheet 2 75
Problem to line 23 81
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question