Signed-off-by: Derrick Mehaffy <derrickmehaffy@gmail.com>

This commit is contained in:
derrickmehaffy 2022-10-05 11:26:17 -07:00 committed by DMehaffy
parent aa97ec895b
commit 7576d8a257
2 changed files with 6 additions and 2 deletions

View File

@ -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) => {

View File

@ -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 || {};
}
}