The following example demostrates two approaches on how to handle errors in the ASP.NET Core Dashboard application:
- How to specify custom text for internal Dashboard errors
- How to throw a custom exception during a server-side processing and display the error in the Dashboard error toast
The dashboard in this project contains invalid data connection. This example shows how to override the default text in the exception that occurs when a controller tries to load data.
- Implement the
IExceptionFilter
interface to create a custom exception filter and specify a custom exception message. You can specify the displayed text depending on whether the application is in development mode. - Create a custom controller that uses the custom exception filter.
- Specify the
CustomDashboard
controller when you configure endpoints.
How to throw a custom exception during a server-side processing and display the error in the Dashboard error toast
This example shows how to throw a custom exception when a controller loads a dashboard.
- Implement the
IExceptionFilter
interface to create a custom exception filter. You can specify the displayed text depending on whether the application is in development mode. - Create a custom controller that uses the custom exception filter.
- Specify the
CustomDashboard
controller when you configure endpoints. - To throw an exception when the control loads a dashboard, create custom dashboard storage and override the
LoadDashboard
method.
(you will be redirected to DevExpress.com to submit your response)