UNPKG

4.71 kBTypeScriptView Raw
1export interface FeathersErrorJSON {
2 name: string;
3 message: string;
4 code: number;
5 className: string;
6 data?: any;
7 errors?: any;
8}
9export type DynamicError = Error & {
10 [key: string]: any;
11};
12export type ErrorMessage = null | string | DynamicError | {
13 [key: string]: any;
14} | any[];
15export declare class FeathersError extends Error {
16 readonly type: string;
17 readonly code: number;
18 readonly className: string;
19 readonly data: any;
20 readonly errors: any;
21 constructor(err: ErrorMessage, name: string, code: number, className: string, _data: any);
22 toJSON(): FeathersErrorJSON;
23}
24export declare class BadRequest extends FeathersError {
25 constructor(message?: ErrorMessage, data?: any);
26}
27export declare class NotAuthenticated extends FeathersError {
28 constructor(message?: ErrorMessage, data?: any);
29}
30export declare class PaymentError extends FeathersError {
31 constructor(message?: ErrorMessage, data?: any);
32}
33export declare class Forbidden extends FeathersError {
34 constructor(message?: ErrorMessage, data?: any);
35}
36export declare class NotFound extends FeathersError {
37 constructor(message?: ErrorMessage, data?: any);
38}
39export declare class MethodNotAllowed extends FeathersError {
40 constructor(message?: ErrorMessage, data?: any);
41}
42export declare class NotAcceptable extends FeathersError {
43 constructor(message?: ErrorMessage, data?: any);
44}
45export declare class Timeout extends FeathersError {
46 constructor(message?: ErrorMessage, data?: any);
47}
48export declare class Conflict extends FeathersError {
49 constructor(message?: ErrorMessage, data?: any);
50}
51export declare class Gone extends FeathersError {
52 constructor(message?: ErrorMessage, data?: any);
53}
54export declare class LengthRequired extends FeathersError {
55 constructor(message?: ErrorMessage, data?: any);
56}
57export declare class Unprocessable extends FeathersError {
58 constructor(message?: ErrorMessage, data?: any);
59}
60export declare class TooManyRequests extends FeathersError {
61 constructor(message?: ErrorMessage, data?: any);
62}
63export declare class GeneralError extends FeathersError {
64 constructor(message?: ErrorMessage, data?: any);
65}
66export declare class NotImplemented extends FeathersError {
67 constructor(message?: ErrorMessage, data?: any);
68}
69export declare class BadGateway extends FeathersError {
70 constructor(message?: ErrorMessage, data?: any);
71}
72export declare class Unavailable extends FeathersError {
73 constructor(message?: ErrorMessage, data?: any);
74}
75export interface Errors {
76 FeathersError: FeathersError;
77 BadRequest: BadRequest;
78 NotAuthenticated: NotAuthenticated;
79 PaymentError: PaymentError;
80 Forbidden: Forbidden;
81 NotFound: NotFound;
82 MethodNotAllowed: MethodNotAllowed;
83 NotAcceptable: NotAcceptable;
84 Timeout: Timeout;
85 Conflict: Conflict;
86 LengthRequired: LengthRequired;
87 Unprocessable: Unprocessable;
88 TooManyRequests: TooManyRequests;
89 GeneralError: GeneralError;
90 NotImplemented: NotImplemented;
91 BadGateway: BadGateway;
92 Unavailable: Unavailable;
93 400: BadRequest;
94 401: NotAuthenticated;
95 402: PaymentError;
96 403: Forbidden;
97 404: NotFound;
98 405: MethodNotAllowed;
99 406: NotAcceptable;
100 408: Timeout;
101 409: Conflict;
102 411: LengthRequired;
103 422: Unprocessable;
104 429: TooManyRequests;
105 500: GeneralError;
106 501: NotImplemented;
107 502: BadGateway;
108 503: Unavailable;
109}
110export declare const errors: {
111 FeathersError: typeof FeathersError;
112 BadRequest: typeof BadRequest;
113 NotAuthenticated: typeof NotAuthenticated;
114 PaymentError: typeof PaymentError;
115 Forbidden: typeof Forbidden;
116 NotFound: typeof NotFound;
117 MethodNotAllowed: typeof MethodNotAllowed;
118 NotAcceptable: typeof NotAcceptable;
119 Timeout: typeof Timeout;
120 Conflict: typeof Conflict;
121 LengthRequired: typeof LengthRequired;
122 Unprocessable: typeof Unprocessable;
123 TooManyRequests: typeof TooManyRequests;
124 GeneralError: typeof GeneralError;
125 NotImplemented: typeof NotImplemented;
126 BadGateway: typeof BadGateway;
127 Unavailable: typeof Unavailable;
128 400: typeof BadRequest;
129 401: typeof NotAuthenticated;
130 402: typeof PaymentError;
131 403: typeof Forbidden;
132 404: typeof NotFound;
133 405: typeof MethodNotAllowed;
134 406: typeof NotAcceptable;
135 408: typeof Timeout;
136 409: typeof Conflict;
137 410: typeof Gone;
138 411: typeof LengthRequired;
139 422: typeof Unprocessable;
140 429: typeof TooManyRequests;
141 500: typeof GeneralError;
142 501: typeof NotImplemented;
143 502: typeof BadGateway;
144 503: typeof Unavailable;
145};
146export declare function convert(error: any): any;