Unexpected error handling

This is an example of server-side script logic for trapping an unexpected error that could occur during a method call:


Dim r As IPFMethodReturnValueI = context.InvokeMethod(Datasource, "SLCtps", 
"PortalGetCTP", parameters)
If Not r.MethodCompleted Then
IPFGlobalScripts.UnexpectedErrors.PostUnexpectedError(context.SessionContext, 
context.LayoutContext, "PortalGetCTP", r.Message)
Exit Sub
Else
...

This calls a global script that handles creating the generic error message and posting it to the portal diagnostics log file. If an error occurs, the message is posted to the log whether or not diagnostics is turned on.