Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Error Handling.....

Posted on 2000-05-18
6
Medium Priority
?
167 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 5

Accepted Solution

by:
AnswerTheMan earned 400 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

Industry Leaders: 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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
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…
Suggested Courses

926 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