Solved

Error Handling.....

Posted on 2000-05-18
6
159 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now