Skip to main content
All docs
V25.2
  • IErrorNotifier Interface

    Allows you to handle errors in the Blazor Report Viewer (the DxReportViewer component).

    Namespace: DevExpress.Blazor.Reporting.Services

    Assembly: DevExpress.Blazor.v25.2.Viewer.dll

    NuGet Package: DevExpress.Blazor.Viewer

    Declaration

    public interface IErrorNotifier

    Remarks

    To customize error messages shown the Report Viewer’ UI, implement the IErrorNotifier interface and register your service at application startup.

    The following code snippet creates a MyErrorNotifier class. The class is used to display a custom message to end users if a DataRetrievalException occurs:

    using System;
    using DevExpress.Blazor.Reporting.Services;
    
    public class MyErrorNotifier : IErrorNotifier {
        public event Action<string> OnErrorMessage;
    
        public void ProcessError(Exception exception) {
            string message = "Internal Server Error";
                var dataRetrievalException = exception as DevExpress.XtraReports.DataRetrievalException;
                if(dataRetrievalException != null && dataRetrievalException.InnerException is DevExpress.DataAccess.Sql.DatabaseConnectionException) {
                message = "Please try again later.";
            }
            OnErrorMessage?.Invoke(message);
        }
    }
    

    Register the MyErrorNotifier class at application startup (the Program.cs file):

    builder.Services.AddScoped<IErrorNotifier, MyErrorNotifier>();
    
    See Also