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

ExceptionHandler.GetExceptionMessage(Exception) Method

Enables you to handle all server-side errors independently from their types.

Namespace: DevExpress.XtraReports.Web.ClientControls

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

NuGet Package: DevExpress.Web.Reporting.Common

Declaration

public virtual 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 following classes are inherited from the base ExceptionHandler class and provide this method:

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

using System;
using DevExpress.XtraReports.Web.ReportDesigner.Services;

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

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

void Application_Start(object sender, EventArgs e) {
    // ...
    DevExpress.XtraReports.Web.ReportDesigner.DefaultReportDesignerContainer.
        Register<IReportDesignerExceptionHandler, CustomReportDesignerExceptionHandler>();
}

See the following topics for more information:

See Also