Skip to main content
All docs
V25.1
  • .NET 8.0+
    • The page you are viewing does not exist in the .NET Framework 4.6.2+ platform documentation. This link will take you to the parent topic of the current section.

    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.1.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