Skip to main content

IExceptionHandler Interface

A base interface to handle server-side errors in the web reporting controls.

Namespace: DevExpress.XtraReports.Web.ClientControls

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

NuGet Package: DevExpress.Web.Reporting.Common

Declaration

public interface IExceptionHandler

Remarks

The following interfaces are inherited from the IExceptionHandler interface:

This base interface provides the GetExceptionMessage method that is called when any server-side error occurs.

The following code snippet demonstrates how to implement this method and return an actual exception message:

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

public class CustomExceptionHandler : IReportDesignerExceptionHandler, 
    IWebDocumentViewerExceptionHandler, IQueryBuilderExceptionHandler {
    public string GetExceptionMessage(Exception ex) {
        return ex.Message;
    }
}

To register the implemented exception handler, use the static methods at the application’s startup as shown below:

void Application_Start(object sender, EventArgs e) {
    // ...
    DevExpress.XtraReports.Web.WebDocumentViewer.DefaultWebDocumentViewerContainer.
        Register<IWebDocumentViewerExceptionHandler, CustomExceptionHandler>();
    DevExpress.XtraReports.Web.ReportDesigner.DefaultReportDesignerContainer.
        Register<IReportDesignerExceptionHandler, CustomExceptionHandler>();
    DevExpress.XtraReports.Web.QueryBuilder.DefaultQueryBuilderContainer.
        Register<IQueryBuilderExceptionHandler, CustomExceptionHandler>();
}
See Also