Source

admin-bro/src/backend/utils/errors/forbidden-error.ts

/**
 * Error which is thrown when user
 * doesn't have an access to a given resource/action.
 *
 * @category Errors
 */
export class ForbiddenError extends Error {
  /**
   * HTTP Status code: 403
   */
  public statusCode: number

  /**
   * Any custom message which should be seen in the UI
   */
  public baseMessage?: string

  /**
   * @param {string} [message]
   */
  constructor(message?: string) {
    super('You cannot perform this action')
    this.statusCode = 403
    this.baseMessage = message
    this.name = 'ForbiddenError'
  }
}

export default ForbiddenError
SoftwareBrothers

Proudly built and maintained by SoftwareBrothers

Software House with a passion for both JavaScript and TypeScript.

See what we do See what we believe in

Proudly built and maintained by

SoftwareBrothers