views:

26

answers:

1

Hi,

We have a sharepoint 2007 project at work. The exception handling policy is to log to the Sharepoint logs.

In this case, would the best approach be to call that method and then rethrow the exception higher up? Except if I rethrow it to be caught higher up, there is no other exception handling code so what would happen in this case?

Also, if you are going to display a more friendly error to the user (which uses information in the exception object), then this would be a good use of exception wrapping. Would it be a good idea to make a custom aspx page and add these to customerrors, so that on init (not sure of the exact event), I can display exception info in the passed parameter on the page. However, a static html page can't do this so I don't see the point in wrapping exceptions (unless there is a page or alert which uses the exception object). So if a project uses html pages for errors, is there a point in wrapping exceptions?

Thanks

A: 

You can use an error page to do this. I think for security reasons you should not display the full stack trace. Also it would not be very user friendly. You can catch the exception at teh highest level and then you can check and see what type of error it is and display a friendly message for that. I have seen this done in JSPs so I think you can do the same in ASP.

I'll have to look into that. But what happens if I rethrow the exception and there is nothing to catch this?
dotnetdev
If there is an unhandled exception in Sharepoint, you'll see a simple page with this message: 'An unexpected error has occurred.'
Tim Larson