We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 167af20 commit b7e6faaCopy full SHA for b7e6faa
lib/src/middlewares/error_handler.dart
@@ -66,6 +66,12 @@ Middleware errorHandler() {
66
67
/// Maps HttpException subtypes to appropriate HTTP status codes.
68
int _mapExceptionToStatusCode(HttpException exception) {
69
+ // Special case for rate limiting
70
+ if (exception is ForbiddenException &&
71
+ exception.message.contains('too many requests')) {
72
+ return 429; // Too Many Requests
73
+ }
74
+
75
return switch (exception) {
76
InvalidInputException() => HttpStatus.badRequest, // 400
77
AuthenticationException() => HttpStatus.unauthorized, // 401
0 commit comments