Back to Devexpress

WebDocumentViewerExceptionHandler Class

xtrareports-devexpress-dot-xtrareports-dot-web-dot-webdocumentviewer-11e3a137.md

latest5.2 KB
Original Source

WebDocumentViewerExceptionHandler Class

Enables you to handle server-side errors in the Web Document Viewer.

Namespace : DevExpress.XtraReports.Web.WebDocumentViewer

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

NuGet Package : DevExpress.Web.Reporting.Common

Declaration

csharp
public class WebDocumentViewerExceptionHandler :
    ExceptionHandler,
    IWebDocumentViewerExceptionHandler,
    IExceptionHandler
vb
Public Class WebDocumentViewerExceptionHandler
    Inherits ExceptionHandler
    Implements IWebDocumentViewerExceptionHandler,
               IExceptionHandler

Remarks

The WebDocumentViewerExceptionHandler class provides the following methods:

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

csharp
using System;
using DevExpress.XtraReports.Web.WebDocumentViewer;

public class CustomWebDocumentViewerExceptionHandler : WebDocumentViewerExceptionHandler {
    public override string GetUnknownExceptionMessage(Exception ex) {
        return ex.Message;
    }
}
vb
Imports System
Imports DevExpress.XtraReports.Web.WebDocumentViewer

Public Class CustomWebDocumentViewerExceptionHandler
    Inherits WebDocumentViewerExceptionHandler

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

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

csharp
void Application_Start(object sender, EventArgs e) {
    // ...
    DevExpress.XtraReports.Web.WebDocumentViewer.DefaultWebDocumentViewerContainer.
      Register<IWebDocumentViewerExceptionHandler, CustomWebDocumentViewerExceptionHandler>();
}
vb
Private Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
    ' ...
    DevExpress.XtraReports.Web.WebDocumentViewer.DefaultWebDocumentViewerContainer.
      Register(Of IWebDocumentViewerExceptionHandler, CustomWebDocumentViewerExceptionHandler)()
End Sub

See the following topics for more information:

Implements

IWebDocumentViewerExceptionHandler

IExceptionHandler

Inheritance

Object ExceptionHandler WebDocumentViewerExceptionHandler

See Also

WebDocumentViewerExceptionHandler Members

DevExpress.XtraReports.Web.WebDocumentViewer Namespace