Results 1 to 15 of 15

Thread: Advanced Error Handler

  1. #1

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Advanced Error Handler

    Thought I'd bring peoples attention to an "advanced" error handler that I wrote months back.
    Since this is always a topic on conversation I thought it was worth while posting an example.
    If you have any questions then give me a shout...post replys in this thread.

    Here's the link:

    http://www.vbforums.com/showthread.p...hreadid=271178

    Woka

    PS: Err Handler, ErrHandler, Error Handler, Handling Errors, How To Handle Errors, Dealing With Errors, Displaying Errors, Woof, Glagnorg, Klupnikaf

  2. #2
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994

    wow

    Err Handler, ErrHandler, Error Handler, Handling Errors, How To Handle Errors, Dealing With Errors, Displaying Errors, Woof
    You forgot Glagnorg and Klupnikaf! What if people search for thoose? ha? ha?

    Shame on you, SHAME!
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

  3. #3
    Fanatic Member
    Join Date
    Sep 2000
    Posts
    770
    LOL

  4. #4

  5. #5
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    I haven't looked at yours yet, but the one I posted in this thread:

    http://www.vbforums.com/showthread.p...ighlight=error

    Does logging to a log file.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  6. #6

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    Code has now been updated. It does save all info to a log file...

    Does your code allow for "history", ie every sub/function that the code execution has passed through?

    Woka

  7. #7
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    No, but I feel this is kinda pointless, IMO. All I need to know is where the error was generated from (ie. what function) and what the error was generated. Mine does that and is easily implemented with the click of a button (via MZTools) to whatever new function/procedure I add to the project.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  8. #8

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    I disagree. Having a history of where the code execution has been is a GREAT help.
    I single function can be called from MANY different sub/functions. Sometimes the errors are a nightmare to trace, and every little bit of info helps. For me, personally, I have found the history of the code execution to be an absolute god send

    Woka

  9. #9
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    To each his own
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  10. #10

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    Completely agreed

    The reason I say that it's helpful is that in a HUGE application, that may go through say 20 subs in one go, the cause of the error could happen in the 10th sub, but doesn't cause an error until it reaches the 20th one. So really there is nothing wrong with the 20th sub. Having a history allows me to track backwards and find the exact source of the error...

    Quick silly example:
    VB Code:
    1. Private Sub Woof()
    2. Dim nodItem   As Node  
    3.    Growl nodItem
    4.    Set nodItem = Nothing
    5. End Sub
    6.  
    7. Private Sub Growl(ByRef pnodItem As Node)
    8.    pnodItem.Text = "Fish"
    9. End Sub
    The above code is passing a treeview node around.
    The error occurs in the sub Growl, however, there is nothing wrong with this sub.
    The error actually originates from Woof, as I missed out the line:
    VB Code:
    1. Set nodItem = Treeview1.Nodes.Add
    If Growl is called from loads of different subs, then I wouldn't know where to start looking. With my code I would know that on this occasion, that caused the error, it was called from Woof, so this would be my 1st port of call to see what was going on.
    If you didn't have the history then you wouldn't know where to start looking.

    Woka

  11. #11
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    I see your point. And I will be checking out your handler, but I still stand by my first stance. Then again, I can't say that I've ever passed through more than 5 or 6 subs on the way to an error.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  12. #12
    Fanatic Member
    Join Date
    Sep 2000
    Posts
    770
    Yes, my opinion but I do agree with Wokawidget, outputing the sub/function as apart of your logging has really helped me in the past to debug HUGE projects.

  13. #13

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    I have a new super-duper error handler in the pipe line. Does pretty much the same thing, but is much more solid and slightly better coding.
    Will post an update tmrw hopefully.

    Woka

    PS Have a look at the project and let me know of any pros/cons

  14. #14
    Frenzied Member agmorgan's Avatar
    Join Date
    Dec 2000
    Location
    Lurking
    Posts
    1,383

    Re: Advanced Error Handler

    Is the super duper version what is currently in the Codebank?

    Anyway, I was wondering what peoples opinions are on adding line numbers (using MZTools) and then using Erl in this dll to log the line at which the error occurred.

    Obviously when you are debugging it is easy to jump to the error line, however, if you have a very large sub and you get
    ERROR NUMBER:
    6

    DESCRIPTION:
    Overflow
    there is still a fair amount of debugging to work out what is wrong.

  15. #15
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Advanced Error Handler

    How about this?
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width