locked
Global error handling? RRS feed

  • Question

  • How can I add global error handling in LS? In other words, is there some sort of Application_OnError method that I can override to handle unhandled exceptions?

    I am trying to use log4net to log and send emails with errors.

    Thanks,

    Juan

    Wednesday, March 2, 2011 4:13 PM

Answers

  • How can I add global error handling in LS? In other words, is there some sort of Application_OnError method that I can override to handle unhandled exceptions?

    I am trying to use log4net to log and send emails with errors.

    There isn't a "catch any kind of error anywhere" type facility in lightswitch. 

    A key place that you should look for (and log) errors would be in the Submit operation on the server.  We provide a special override method called "SaveChangese_ExecuteFailed" which will be called anytime there was a failure trying to complete a save operation on the server.

    Depending on what other types of errors you'd like to catch, perhaps there are other places for you to put in your log4net calls.

     

    Wednesday, March 2, 2011 5:21 PM