The requested page is not available for the requested platform. You are viewing the content for Default platform.

WebDocumentViewerExceptionHandler.GetExceptionMessage(Exception) Method

Enables you to handle all server-side errors independent of their types.

Namespace: DevExpress.XtraReports.Web.WebDocumentViewer

Assembly: DevExpress.XtraReports.v19.2.Web.dll

Declaration

public override string GetExceptionMessage(
    Exception ex
)
Public Overrides Function GetExceptionMessage(
    ex As Exception
) As String

Parameters

Name Type Description
ex Exception

An exception that occurs on the server side.

Returns

Type Description
String

A string to show in a browser when an error occurs.

Remarks

The GetExceptionMessage method is called when any server-side error occurs.

The code snippet below demonstrates how to create a descendant from the WebDocumentViewerExceptionHandler class and override the GetExceptionMessage method to return an actual exception message.

using System;
using DevExpress.XtraReports.Web.WebDocumentViewer;

public class CustomWebDocumentViewerExceptionHandler : WebDocumentViewerExceptionHandler {
    public override string GetExceptionMessage(Exception  ex) {
        return ex.Message;
    }
}

To register the implemented exception handler, use the static DefaultWebDocumentViewerContainer.Register method at the application's startup as shown below:

void Application_Start(object sender, EventArgs e) {
    // ...
    DevExpress.XtraReports.Web.WebDocumentViewer.DefaultWebDocumentViewerContainer.
      Register<IWebDocumentViewerExceptionHandler, CustomWebDocumentViewerExceptionHandler>();
}

See the following topics for more information:

See Also