mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 15:13:21 +00:00
Signed-off-by: Derrick Mehaffy <derrickmehaffy@gmail.com>
This commit is contained in:
parent
aa97ec895b
commit
7576d8a257
@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const createError = require('http-errors');
|
||||
const { NotFoundError, UnauthorizedError, ForbiddenError, PayloadTooLargeError } =
|
||||
const { NotFoundError, UnauthorizedError, ForbiddenError, PayloadTooLargeError, PolicyError } =
|
||||
require('@strapi/utils').errors;
|
||||
|
||||
const mapErrorsAndStatus = [
|
||||
@ -21,6 +21,10 @@ const mapErrorsAndStatus = [
|
||||
classError: PayloadTooLargeError,
|
||||
status: 413,
|
||||
},
|
||||
{
|
||||
classError: PolicyError,
|
||||
status: 429,
|
||||
},
|
||||
];
|
||||
|
||||
const formatApplicationError = (error) => {
|
||||
|
||||
@ -68,7 +68,7 @@ class RateLimitError extends ApplicationError {
|
||||
super(message, details);
|
||||
this.name = 'RateLimitError';
|
||||
this.message = message || 'Too many requests, please try again later.';
|
||||
this.status = 429;
|
||||
this.details = details || {};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user