import { Exception } from '@adonisjs/core/exceptions'; import type { HttpContext } from '@adonisjs/core/http'; import type { AuthorizationResponse } from './response.ts'; /** * AuthorizationException is raised by bouncer when an ability or * policy denies access to a user for a given resource. This exception * provides rich error information including status codes and internationalization support. * * @example * ```js * throw new E_AUTHORIZATION_FAILURE(response) * ``` */ declare class AuthorizationException extends Exception { response: AuthorizationResponse; formSubmissionMethods: string[]; /** * Default error message */ message: string; /** * Default HTTP status code */ status: number; /** * Error code identifier */ code: string; /** * Error identifier to lookup translation message */ identifier: string; /** * Create a new AuthorizationException * * @param response Authorization response containing denial information * @param options Optional error configuration */ constructor(response: AuthorizationResponse, options?: ErrorOptions & { code?: string; status?: number; }); /** * Returns the message to be sent in the HTTP response. * Feel free to override this method and return a custom * response. * * @param ctx HTTP context for accessing i18n and other services */ getResponseMessage(ctx: HttpContext): string; /** * Handle the authorization exception and send appropriate HTTP response * * @param _ The exception instance (not used) * @param ctx HTTP context for sending the response */ handle(_: AuthorizationException, ctx: HttpContext): Promise; } export declare const E_AUTHORIZATION_FAILURE: typeof AuthorizationException; export {};