Wednesday, November 23, 2011

SharePoint 2010: Exception Handling Scope & SharePoint 2010 Page Rating using Social Data Service (SocialDataService.asmx)

SharePoint 2010 Page Rating using Social Data Service (SocialDataService.asmx)


Social Data Service


FREE SP 2010


*****************************************************************************
Error Handling
In this examples , I’ve left error handling and boundary checking code out for
the sake of brevity. Of course, in real-world code, we’d add these things and create suitable unit tests to validate their functionality. To make it possible for us to filter SharePoint specific errors in try/catch blocks, all SharePoint exceptions are derived from the SPException class.Earlier we looked at Sysinternals DebugView as a tool to assist in debugging problems in server-side code. Although we could use this as an error logging tool, SharePoint provides a better way to achieve the same result. Using code similar to the following sample, we can
write error logging entries to the SharePoint Unified Logging Service (ULS) logs:
try
{
//some code
}
catch (Exception ex)
{
SPDiagnosticsCategory myCat=new SPDiagnosticsCategory("A new category",
TraceSeverity.Monitorable,
EventSeverity.Error);
SPDiagnosticsService.Local.WriteEvent(1, myCat,
EventSeverity.Error,
"My custom message",
ex.StackTrace);
}
********************************************************************************


SharePoint 2010: Exception Handling Scope

Exception Handling Scope2

Bullet proof coding – SharePoint Error checking and Exception handling


How to use ULS in SharePoint 2010 for Custom Code Exception Logging?


SharePoint 2010 Cookbook: Using ULS Logging


Log your errors in SharePoint to Windows Event log or SharePoint Log files


404 Page Not Found error - after migrating from MOSS 2007 to SharePoint 2010
SharePoint Trace Logs (ULS) and Log Viewer

No comments:

Blog Archive