Solved

Error Handling.....

Posted on 2000-05-18
6
162 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
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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

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.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

776 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