Back to Devexpress

ExceptionService Class

expressappframework-devexpress-dot-expressapp-dot-blazor-dot-services.md

latest2.5 KB
Original Source

ExceptionService Class

A service that allows you to handle exceptions in a custom manner.

Namespace : DevExpress.ExpressApp.Blazor.Services

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

NuGet Package : DevExpress.ExpressApp.Blazor

Declaration

csharp
public class ExceptionService :
    IExceptionHandlerService,
    IExceptionProviderService
vb
Public Class ExceptionService
    Implements IExceptionHandlerService,
               IExceptionProviderService

Remarks

Note

For more information about the default error processing mechanism in XAF ASP.NET Core Blazor applications, refer to the following topic: Error Handling in ASP.NET Core Blazor.

Override the ExceptionService.HandleException(Exception) method in the class descendant to wrap an exception in a user-friendly exception.

Override the ExceptionService.ShouldHandleException(Exception) method in the class descendant to determine how you want to process exceptions.

The following example displays a user-friendly exception message in your XAF Blazor UI application:

  1. Add a controller:

  2. Add a MyTestExceptionService service and override the HandleException method:

  3. Register the MyTestExceptionService service in the MySolution.Blazor.Server\Startup.cs file:

  4. Run the application and click the Test Action button. The user-friendly exception is displayed within a toast notification.

Inheritance

Object ExceptionService

See Also

ExceptionService Members

DevExpress.ExpressApp.Blazor.Services Namespace