xtrareports-devexpress-dot-xtrareports-dot-web-dot-clientcontrols-094e5428.md
A base interface to handle server-side errors in the web reporting controls.
Namespace : DevExpress.XtraReports.Web.ClientControls
Assembly : DevExpress.XtraReports.v25.2.Web.dll
NuGet Package : DevExpress.Web.Reporting.Common
public interface IExceptionHandler
Public Interface IExceptionHandler
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;
}
}
Imports System
Imports DevExpress.XtraReports.Web.QueryBuilder.Services
Imports DevExpress.XtraReports.Web.ReportDesigner.Services
Imports DevExpress.XtraReports.Web.WebDocumentViewer
Public Class CustomExceptionHandler
Inherits IReportDesignerExceptionHandler
Implements IWebDocumentViewerExceptionHandler, IQueryBuilderExceptionHandler
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 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>();
}
Private Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' ...
DevExpress.XtraReports.Web.WebDocumentViewer.DefaultWebDocumentViewerContainer.
Register(Of IWebDocumentViewerExceptionHandler, CustomExceptionHandler)()
DevExpress.XtraReports.Web.ReportDesigner.DefaultReportDesignerContainer.
Register(Of IReportDesignerExceptionHandler, CustomExceptionHandler)()
DevExpress.XtraReports.Web.QueryBuilder.DefaultQueryBuilderContainer.
Register(Of IQueryBuilderExceptionHandler, CustomExceptionHandler)()
End Sub
See Also