Browse Source

#3328 Documented "Subscribing to the Exceptions"

pull/3334/head
Halil İbrahim Kalkan 7 years ago
parent
commit
4511062b30
  1. 20
      docs/en/Exception-Handling.md

20
docs/en/Exception-Handling.md

@ -291,6 +291,26 @@ services.Configure<AbpExceptionHttpStatusCodeOptions>(options =>
});
````
## Subscribing to the Exceptions
It is possible to be informed when the ABP Framework **handles an exception**. It automatically **logs** all the exceptions to the standard [logger](Logging.md), but you may want to do more.
In this case, create a class derived from the `ExceptionSubscriber` class in your application:
````csharp
public class MyExceptionSubscriber : ExceptionSubscriber
{
public override async Task HandleAsync(ExceptionNotificationContext context)
{
//TODO...
}
}
````
The `context` object contains necessary information about the exception occurred.
> You can have multiple subscribers, each gets a copy of the exception. Exceptions thrown by your subscriber is ignored (but still logged).
## Built-In Exceptions
Some exception types are automatically thrown by the framework:

Loading…
Cancel
Save