Skip to content

Commit

Permalink
feat(readme): added message guide
Browse files Browse the repository at this point in the history
  • Loading branch information
zhifenglee-aelf committed Oct 10, 2024
1 parent 507924e commit 37dde58
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ A demo of AOP Exception Handling.
- [Callback Method](#callback-method)
- [Finally](#finally)
- [Logging](#logging)
- [Message](#message)
- [Examples](#examples)
- [Contributing](#contributing)
- [License](#license)
Expand Down Expand Up @@ -218,6 +219,22 @@ protected virtual async Task<bool> SomeMethod(string message)
}
```

### Message

You may set customised message for the exception. For example:
```csharp
[ExceptionHandler(typeof(Exception),
Message = "Customised message",
TargetType = typeof(BookAppService),
MethodName = nameof(HandleException))]
protected virtual async Task<bool> SomeMethod(string message)
{
throw new Exception("boo!");
return false;
}
```
This would output "Customised message" along with the exception message.

## Examples

Example with multiple exception handler:
Expand Down

0 comments on commit 37dde58

Please sign in to comment.