Exception Handling

Discussion in 'ASP .Net' started by =?Utf-8?B?WUM=?=, Jun 26, 2006.

  1. Hi,
    Question regarding exception handling in a distributed application - I have
    a web service facade which expose methods to an asp.net client.
    I'm thinking of handling application exceptions in the application_error in
    the service global.asax.
    Does the application_error occurs in the same thread as the current request
    or does it occur in a main thread of the application?

    Thanks

    Yoav
     
    =?Utf-8?B?WUM=?=, Jun 26, 2006
    #1
    1. Advertising

  2. It happens for entire Application. You can check this in Session_error
    event, which will tell you the current context.

    Moreover, I would like to suggest you to handle all the errors in the
    methods and send your own exception class with formated exception
    messages. Since it is a webservice you need to give back an IEnumerable
    object which could sent as an xml data.

    Let us know if you face any problems.

    -
    Vadivel Kumar
    http://vadivelk.net
     
    Vadivel Kumar, Jun 26, 2006
    #2
    1. Advertising

  3. thanks for replying.
    Do you mean that the thread which the application_error occurs in is the
    same for the entire application?
    I'm asking because it can be a problem if it happens in the same thread for
    all the requests. it can cause a bottle neck.
    As for formatting the message - I can format it in this event as well as in
    the web methods, no?

    thanks

    "Vadivel Kumar" wrote:

    > It happens for entire Application. You can check this in Session_error
    > event, which will tell you the current context.
    >
    > Moreover, I would like to suggest you to handle all the errors in the
    > methods and send your own exception class with formated exception
    > messages. Since it is a webservice you need to give back an IEnumerable
    > object which could sent as an xml data.
    >
    > Let us know if you face any problems.
    >
    > -
    > Vadivel Kumar
    > http://vadivelk.net
    >
     
    =?Utf-8?B?WUM=?=, Jun 26, 2006
    #3
  4. I guess, you dont need to care about Application_error method, you have
    just do this in session_error and implement the error handling in for
    the current context. Perhaps, for all the sessions this method will get
    fired and you put this message up.

    As far as formatting goes, you should have a custom exception class and
    in all the methods you throw the exception thru this. This class can
    have all the implementation related to formating the message, stack
    trace etc., based on your needs. You keep this object in a state object
    which can hold the currently executed error (like win api's
    GetLastError() ). In the session_error method call this method and put
    the message in the screen after doing UI level formatting

    Let me know if you have any issue.

    -
    Vadivel Kumar
    http://vadivelk.net
     
    Vadivel Kumar, Jun 26, 2006
    #4
  5. Thanks.
    I'll look into it.

    "Vadivel Kumar" wrote:

    > I guess, you dont need to care about Application_error method, you have
    > just do this in session_error and implement the error handling in for
    > the current context. Perhaps, for all the sessions this method will get
    > fired and you put this message up.
    >
    > As far as formatting goes, you should have a custom exception class and
    > in all the methods you throw the exception thru this. This class can
    > have all the implementation related to formating the message, stack
    > trace etc., based on your needs. You keep this object in a state object
    > which can hold the currently executed error (like win api's
    > GetLastError() ). In the session_error method call this method and put
    > the message in the screen after doing UI level formatting
    >
    > Let me know if you have any issue.
    >
    > -
    > Vadivel Kumar
    > http://vadivelk.net
    >
     
    =?Utf-8?B?WUM=?=, Jun 26, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Babu
    Replies:
    1
    Views:
    2,927
    Jim Gibson
    Mar 10, 2005
  2. Mark Tarver
    Replies:
    22
    Views:
    1,354
    J Kenneth King
    Apr 26, 2009
  3. Peter
    Replies:
    34
    Views:
    1,998
    James Kanze
    Oct 17, 2009
  4. VSK
    Replies:
    0
    Views:
    261
  5. Iñaki Baz Castillo
    Replies:
    1
    Views:
    213
    Iñaki Baz Castillo
    Apr 15, 2008
Loading...

Share This Page