mirror of
https://github.com/strapi/strapi.git
synced 2026-01-06 04:03:25 +00:00
change default policies error
Signed-off-by: Derrick Mehaffy <derrickmehaffy@gmail.com>
This commit is contained in:
parent
9fd85b9bfd
commit
4dbb64e8a2
@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const { propOr } = require('lodash/fp');
|
||||
const { ForbiddenError } = require('@strapi/utils').errors;
|
||||
const { PolicyError } = require('@strapi/utils').errors;
|
||||
const { policy: policyUtils } = require('@strapi/utils');
|
||||
|
||||
const getPoliciesConfig = propOr([], 'config.policies');
|
||||
@ -17,7 +17,7 @@ const resolvePolicies = route => {
|
||||
const result = await handler(context, config, { strapi });
|
||||
|
||||
if (![true, undefined].includes(result)) {
|
||||
throw new ForbiddenError('Policies failed.');
|
||||
throw new PolicyError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -69,7 +69,7 @@ class UnauthorizedError extends ApplicationError {
|
||||
}
|
||||
}
|
||||
|
||||
class PolicyError extends ApplicationError {
|
||||
class PolicyError extends ForbiddenError {
|
||||
constructor(message, details) {
|
||||
super(message, details);
|
||||
this.name = 'PolicyError';
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
const { propOr } = require('lodash/fp');
|
||||
const { policy: policyUtils } = require('@strapi/utils');
|
||||
const { ForbiddenError } = require('@strapi/utils').errors;
|
||||
const { PolicyError } = require('@strapi/utils').errors;
|
||||
|
||||
const getPoliciesConfig = propOr([], 'policies');
|
||||
|
||||
@ -19,7 +19,7 @@ const createPoliciesMiddleware = (resolverConfig, { strapi }) => {
|
||||
const result = await handler(context, config, { strapi });
|
||||
|
||||
if (![true, undefined].includes(result)) {
|
||||
throw new ForbiddenError('Policies failed.');
|
||||
throw new PolicyError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user