ForestAdmin/forest-express

View on GitHub
src/services/authorization/errors/custom-action-requires-approval-error.ts

Summary

Maintainability
A
2 hrs
Test Coverage
A
100%
import ForbiddenError from '../../../utils/errors/forbidden-error';

export default class CustomActionRequiresApprovalError extends ForbiddenError {
  data: { roleIdsAllowedToApprove: number[] };

  constructor(roleIdsAllowedToApprove: number[]) {
    super('This action requires to be approved.');

    this.name = 'CustomActionRequiresApprovalError';
    this.data = {
      roleIdsAllowedToApprove,
    };
  }
}