SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru Raskolnikov's Avatar
    Join Date
    Jul 2003
    Location
    USA
    Posts
    606
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Dealing with exceptions (finding Source)

    When a web app throws an exception that isn't handled on the local machine, the default .net error display shows the Source code that caused the error with line numbers etc.

    My current exception handler works pretty well. Logs the exception to a Db and sends an email to a support email address. However, i am wanting to grab the souce code just like what I mentioned above and add this to the error report.

    Exception.source does not do this. I am not even completely sure what exception.source tells you.

    any ideas?

    ras

  2. #2
    SitePoint Zealot
    Join Date
    Dec 2004
    Location
    canada
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey sorry this isnt to help you but I was wondering how you did your exception handler? I am looking for some help to implement that into my system.

  3. #3
    SitePoint Guru Raskolnikov's Avatar
    Join Date
    Jul 2003
    Location
    USA
    Posts
    606
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I created a separate error handler control. The control is in charge of submitting data to my exceptions table in my Db, and shooting off an email.

    So in my main code, in the Catch areas, i just send the appropriate info to the error handler, and it does it all automatically.

    but all the info i have doesn't do me alot of good cause it id difficult to find exactly where the error happens do to the fact that i can not produce a line number.

    Ras

  4. #4
    SitePoint Wizard
    Join Date
    Feb 2007
    Posts
    1,274
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The StackTrace method is what you are after. It will display the entire call stack at the point of exception, along with source file and line numbers if debug symbols are on.

    I don't believe a control is the right way to trap such errors. A handler for the HttpApplication.Error event is the prescribed way. Such a handler can be installed at the application (in global.asax) or in a http module. If you google for it I am sure there are plenty implementations of http modules which can email the stack trace in case of an unhandled exception.


Bookmarks

Posting Permissions

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