Skip to main content
All docs
V25.2
  • ExceptionService.ShouldHandleException(Exception) Method

    Specifies how an exception is processed. If you want to process an exception through IExceptionHandlerService, override this method and return true; if you want to process an exception through ErrorBoundary - return false.

    Namespace: DevExpress.ExpressApp.Blazor.Services

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

    NuGet Package: DevExpress.ExpressApp.Blazor

    Declaration

    public virtual bool ShouldHandleException(
        Exception exception
    )

    Parameters

    Name Type Description
    exception Exception

    A Exception object.

    Returns

    Type Description
    Boolean

    true to use IExceptionHandlerService; false for ErrorBoundary.

    Remarks

    Override this method to indicate how you want to process an exception. See the following code snippet for an example:

    using System;
    using DevExpress.ExpressApp.Blazor.Services;
    using Microsoft.Extensions.Logging;
    using DevExpress.ExpressApp;
    
        public class CustomExceptionHandlerService : ExceptionService {
            public CustomExceptionHandlerService(ILogger<ExceptionService> logger) : base(logger) { 
            }
            public override bool ShouldHandleException(Exception exception) {
                if(exception is MyException) {
                    return true;
                }
                else {
                    return false;
                }
            }
        }
    
    See Also