Home > SharePoint > Handling Un Expected Error Occurred in SharePoint : Exception Handling

Handling Un Expected Error Occurred in SharePoint : Exception Handling

if you need to show your custom message instead of “unexpected error occurred” in SharePoint.
Just go through the trust worthy tip Smile.

use SPException : which represents Windows SharePoint Services exceptions

  • Exception Handling

try

{

//code ….

}

Catch(Exception ex)

{

throw new SPException(“Your User-friendly message”);

}

Advertisements
Categories: SharePoint
  1. Syed Mustafa Shah
    February 12, 2011 at 7:35 pm

    Nice!! this is really handy tip for several cases.
    This can be used to display error messages on standard sharepoint error pages espacially in event handlers and feature recievers.

    Hey dont forget to log/record the original error message somewhere.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: