3.65 kBTypeScriptView Raw
1/// <reference types="node" resolution-mode="require"/>
2import type { HttpContext } from '@adonisjs/core/http';
3/**
4 * The "E_UNAUTHORIZED_ACCESS" exception is raised when unable to
5 * authenticate an incoming HTTP request.
6 *
7 * The "error.guardDriverName" can be used to know the driver which
8 * raised the error.
9 */
10export declare const E_UNAUTHORIZED_ACCESS: {
11 new (message: string, options: {
12 redirectTo?: string;
13 guardDriverName: string;
14 }): {
15 /**
16 * Endpoint to redirect to. Only used by "session" driver
17 * renderer
18 */
19 redirectTo?: string | undefined;
20 /**
21 * Translation identifier. Can be customized
22 */
23 identifier: string;
24 /**
25 * The guard name reference that raised the exception. It allows
26 * us to customize the logic of handling the exception.
27 */
28 guardDriverName: string;
29 /**
30 * A collection of renderers to render the exception to a
31 * response.
32 *
33 * The collection is a key-value pair, where the key is
34 * the guard driver name and value is a factory function
35 * to respond to the request.
36 */
37 renderers: Record<string, (message: string, error: any, ctx: HttpContext) => Promise<void> | void>;
38 /**
39 * Returns the message to be sent in the HTTP response.
40 * Feel free to override this method and return a custom
41 * response.
42 */
43 getResponseMessage(error: any, ctx: HttpContext): string;
44 /**
45 * Converts exception to an HTTP response
46 */
47 handle(error: any, ctx: HttpContext): Promise<void>;
48 name: string;
49 help?: string | undefined;
50 code?: string | undefined;
51 status: number;
52 toString(): string;
53 readonly [Symbol.toStringTag]: string;
54 message: string;
55 stack?: string | undefined;
56 cause?: unknown;
57 };
58 status: number;
59 code: string;
60 help?: string | undefined;
61 message?: string | undefined;
62 captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
63 prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
64 stackTraceLimit: number;
65};
66/**
67 * Exception is raised when user credentials are invalid
68 */
69export declare const E_INVALID_CREDENTIALS: {
70 new (message?: string | undefined, options?: (ErrorOptions & {
71 code?: string | undefined;
72 status?: number | undefined;
73 }) | undefined): {
74 /**
75 * Translation identifier. Can be customized
76 */
77 identifier: string;
78 /**
79 * Returns the message to be sent in the HTTP response.
80 * Feel free to override this method and return a custom
81 * response.
82 */
83 getResponseMessage(error: any, ctx: HttpContext): string;
84 /**
85 * Converts exception to an HTTP response
86 */
87 handle(error: any, ctx: HttpContext): Promise<void>;
88 name: string;
89 help?: string | undefined;
90 code?: string | undefined;
91 status: number;
92 toString(): string;
93 readonly [Symbol.toStringTag]: string;
94 message: string;
95 stack?: string | undefined;
96 cause?: unknown;
97 };
98 status: number;
99 code: string;
100 help?: string | undefined;
101 message?: string | undefined;
102 captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
103 prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
104 stackTraceLimit: number;
105};
106
\No newline at end of file