UNPKG

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