Skip to main content
A newer version of this page is available. .

WebDocumentViewerExceptionHandler.GetExceptionMessage(Exception) Method

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

Namespace: DevExpress.XtraReports.Web.WebDocumentViewer

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

Declaration

public override string GetExceptionMessage(
    Exception ex
)

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