Search code examples
sharepointexceptionmosswindows-sharepoint-services

How do I handle SharePoint exceptions?


I`m new to SharePoint, so I guess how do I need to handle exceptions? When I write custom code do I have to check for them or maybe, if they are thrown, they automatically get logged and don't break the app?

If not, then how do I log them?

Thank you!

Edit: And how should I log those exceptions?


Solution

  • Use this to write to the log: http://msdn.microsoft.com/en-us/library/aa979522.aspx

    Unless you handle your exceptions the application will most likely break. Some errors such as those generated in event receivers will not "break" the application (except for terminating the event receiver). Those, along with all other uncatched errors will end up in the log unless you've changed the settings in central admin.