Solved

Error Handling.....

Posted on 2000-05-18
6
163 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA/SQL - Connect to SQL server and pull data 4 120
Crystal reports - Formula Field code need assistance with code 17 83
Add and format columns in vb6 7 63
vbModal 12 57
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

821 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