Back to Devexpress

IReportDesignerExceptionHandler Interface

xtrareports-devexpress-dot-xtrareports-dot-web-dot-reportdesigner-dot-services-5fa10bad.md

latest4.0 KB
Original Source

IReportDesignerExceptionHandler Interface

Enables you to handle server-side errors in the Web Report Designer.

Namespace : DevExpress.XtraReports.Web.ReportDesigner.Services

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

NuGet Package : DevExpress.Web.Reporting.Common

Declaration

csharp
public interface IReportDesignerExceptionHandler :
    IExceptionHandler
vb
Public Interface IReportDesignerExceptionHandler
    Inherits IExceptionHandler

Remarks

This interface is inherited from the base IExceptionHandler interface and exposes 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:

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

public class CustomExceptionHandler : IReportDesignerExceptionHandler {
    public string GetExceptionMessage(Exception ex) {
        return ex.Message;
    }
}
vb
Imports System
Imports DevExpress.XtraReports.Web.ReportDesigner.Services

Public Class CustomExceptionHandler
    Inherits IReportDesignerExceptionHandler

    Public Function GetExceptionMessage(ByVal ex As Exception) As String
        Return ex.Message
    End Function
End Class

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

csharp
void Application_Start(object sender, EventArgs e) {
    // ...
    DevExpress.XtraReports.Web.ReportDesigner.DefaultReportDesignerContainer.
        Register<IReportDesignerExceptionHandler, CustomExceptionHandler>();
}
vb
Private Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
    ' ...
    DevExpress.XtraReports.Web.ReportDesigner.DefaultReportDesignerContainer.
        Register(Of IReportDesignerExceptionHandler, CustomExceptionHandler)()
End Sub

The ReportDesignerExceptionHandler class is the predefined implementation of the IReportDesignerExceptionHandler interface.

See the following topics for more information:

See Also

IReportDesignerExceptionHandler Members

DevExpress.XtraReports.Web.ReportDesigner.Services Namespace