Skip to content

A free open source IT asset/license management system

Make the 429 error less stupid

snipe2906a8944200
diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php
index 3b396ee7c7..ced68c5bfd 100644
--- a/app/Exceptions/Handler.php
+++ b/app/Exceptions/Handler.php
@@ -84,10 +84,12 @@ class Handler extends ExceptionHandler
switch ($e->getStatusCode()) {
case '404':
return response()->json(Helper::formatStandardApiResponse('error', null, $statusCode . ' endpoint not found'), 404);
- case '405':
+ case '429':
+ return response()->json(Helper::formatStandardApiResponse('error', null, 'Too many requests'), 429);
+ case '405':
return response()->json(Helper::formatStandardApiResponse('error', null, 'Method not allowed'), 405);
default:
- return response()->json(Helper::formatStandardApiResponse('error', null, $statusCode), 405);
+ return response()->json(Helper::formatStandardApiResponse('error', null, $statusCode), $statusCode);
}
}