Commit ae82067
committed
feat(decorators): implement
- Add `Catch` decorator:
- Handles errors in decorated asynchronous methods.
- Supports custom error responses via the `ErrorResponse` type.
- Integrates `grammy` context (`Context`) to send user-friendly error messages in bot interactions.
- Logs errors with detailed metadata, including the target class, method, and error category.
- Automatically handles specific errors (e.g., `bot was kicked`) by cleaning up group data via the `GroupService`.
- Utilize `ServiceProvider` to retrieve necessary services dynamically.
- Improve system reliability by ensuring consistent error handling and user feedback in case of failures.Catch decorator for centralized error handling in async methods1 parent a02deef commit ae82067
1 file changed
Lines changed: 38 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
0 commit comments