VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Exception, Error and Warning handler

by Edwin Vermeer. (11 Submissions)
Category: Libraries
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (3 Votes)

Handeling Errors, Exceptions and warnings is an undervalued part of programming.
If you do it well, it could make your debugging life much easier.
Debugging is not only about finding errors at compile time, its also about finding errors after you program has been realeased.
Adding code for handeling Errors, Exceptions and Warnings should be:
1. Easy = Just add a dll, add 2 lines to install and uninstall, Add 4 lines of code to each sub
2. Generic = Handle all errors in the same way.
3. Tracable = You do not need an error stack. Just let the error float up in the procedure tree while adding information in each step.
4. Locatable = Use line numbers. The only disadvantage is that it will add 10% to your .exe file size. I find it strange that so litle source code uses line numbers. That is probably because it reminds people to much ot the old Basic versions.
5. Robust = Even handle GPF exceptions. (They are getting rare aren't they)
/\/\/\ /\/\/\ /\/\/\ /\/\/\ /\/\/\ /\/\/\ /\/\/\ /\/\/\ Credits: Large parts of the Exception hanler is from a publication by Thushan Fernando. See: https://www.vbcoders.com/vb/scripts/ShowCode.asp?txtCodeId=41471&lngWId=1
Tip:
For adding (and removing) Line numbers I use the tool from Anthony Ciccolini . See: https://www.vbcoders.com/vb/scripts/ShowCode.asp?txtCodeId=49876&lngWId=1 Of course lots of people will prefer something like MX Tools but I like to be in control and be able to change the behaviour.
/\/\/\ /\/\/\ /\/\/\ /\/\/\ /\/\/\ /\/\/\ /\/\/\ /\/\/\ I just converted all my code to open source. This is the first in a series of 15 publications.

Rate Exception, Error and Warning handler

Download Exception, Error and Warning handler

Download Exception, Error and Warning handler (18 KB)

Exception, Error and Warning handler Comments

No comments have been posted about Exception, Error and Warning handler. Why not be the first to post a comment about Exception, Error and Warning handler.

Post your comment

Subject:
Message:
0/1000 characters