UNPKG

9.7 kBTypeScriptView Raw
1export interface IHttpErrorCode {
2 title: string;
3 status: number;
4 message: string;
5}
6export interface IStatusError {
7 statusCode: number;
8}
9export interface ICodeError {
10 code: string;
11}
12/**
13 * @class
14 * @augments TypeError
15 */
16export declare class AbstractMethodError extends TypeError {
17 constructor(message?: string);
18}
19/**
20 * @classdesc Abstract Class Exception
21 * @class
22 * @augments Error
23 *
24 */
25export declare class AbstractClassError extends TypeError {
26 constructor(message?: string);
27}
28/**
29 * @class
30 * @augments Error
31 */
32export declare class FileNotFoundError extends Error {
33 constructor(message?: string);
34}
35/**
36 * @class
37 * @augments Error
38 */
39export declare class HttpError extends Error implements IStatusError {
40 /**
41 * @param {Error} err
42 * @returns {HttpError}
43 */
44 static create(err: any): HttpError;
45 /**
46 * Gets or sets a short title for this HTTP error (e.g. Not Found, Bad Request)
47 */
48 title: string;
49 /**
50 * Gets or sets the status code if this HTTP error
51 */
52 statusCode: number;
53 /**
54 * Gets or sets an inner message for this HTTP error.
55 */
56 innerMessage: string;
57 /**
58 * @constructor
59 * @param {number=} status
60 * @param {string=} message
61 * @param {string=} innerMessage
62 */
63 constructor(status?: number, message?: string, innerMessage?: string);
64}
65/**
66 * @classdesc HTTP 400 Bad Request exception class
67 * @class
68 */
69export declare class HttpBadRequestError extends HttpError {
70 /**
71 * @constructor
72 * @param {string=} message
73 * @param {string=} innerMessage
74 */
75 constructor(message?: string, innerMessage?: string);
76}
77/**
78 * @classdesc HTTP 404 Not Found Exception class
79 * @class
80 * @augments HttpError
81 */
82export declare class HttpNotFoundError extends HttpError {
83 /**
84 * @constructor
85 * @param {string=} message
86 * @param {string=} innerMessage
87 */
88 constructor(message?: string, innerMessage?: string);
89 /**
90 * Gets or sets the resource which could not to be found
91 */
92 resource: string;
93}
94/**
95 * @classdesc HTTP 405 Method Not Allowed exception class
96 * @class
97 * @augments HttpError
98 */
99export declare class HttpMethodNotAllowedError extends HttpError {
100 /**
101 * @constructor
102 * @param {string=} message
103 * @param {string=} innerMessage
104 */
105 constructor(message?: string, innerMessage?: string);
106}
107/**
108 * @classdesc HTTP 406 Not Acceptable exception class
109 * @class
110 * @augments HttpError
111 */
112export declare class HttpNotAcceptableError extends HttpError {
113 /**
114 * @constructor
115 * @param {string=} message
116 * @param {string=} innerMessage
117 */
118 constructor(message?: string, innerMessage?: string);
119}
120/**
121 * @classdesc HTTP 408 RequestTimeout exception class
122 * @class
123 * @augments HttpError
124 */
125export declare class HttpRequestTimeoutError extends HttpError {
126 /**
127 * @constructor
128 * @param {string=} message
129 * @param {string=} innerMessage
130 */
131 constructor(message?: string, innerMessage?: string);
132}
133/**
134 * @classdesc HTTP 409 Conflict exception class
135 * @class
136 * @augments HttpError
137 */
138export declare class HttpConflictError extends HttpError {
139 /**
140 * @constructor
141 * @param {string=} message
142 * @param {string=} innerMessage
143 */
144 constructor(message?: string, innerMessage?: string);
145}
146/**
147 * @classdesc HTTP 498 Token Expired exception class
148 * @class
149 * @augments HttpError
150 */
151export declare class HttpTokenExpiredError extends HttpError {
152 /**
153 * @constructor
154 * @param {string=} message
155 * @param {string=} innerMessage
156 */
157 constructor(message?: string, innerMessage?: string);
158}
159/**
160 * @classdesc HTTP 499 Token Required exception class
161 * @class
162 * @augments HttpError
163 */
164export declare class HttpTokenRequiredError extends HttpError {
165 /**
166 * @constructor
167 * @param {string=} message
168 * @param {string=} innerMessage
169 */
170 constructor(message?: string, innerMessage?: string);
171}
172/**
173 * @classdesc HTTP 401 Unauthorized Exception class
174 * @class
175 * @augments HttpError
176 */
177export declare class HttpUnauthorizedError extends HttpError {
178 /**
179 * @constructor
180 * @param {string=} message
181 * @param {string=} innerMessage
182 */
183 constructor(message?: string, innerMessage?: string);
184}
185/**
186 * HTTP 403 Forbidden Exception class
187 * @class
188 * @param {string=} message
189 * @param {string=} innerMessage
190 * @augments HttpError
191 */
192export declare class HttpForbiddenError extends HttpError {
193 /**
194 * @constructor
195 * @param {string=} message
196 * @param {string=} innerMessage
197 */
198 constructor(message?: string, innerMessage?: string);
199}
200/**
201 * @classdesc HTTP 500 Internal Server Error Exception class
202 * @class
203 * @augments HttpError
204 */
205export declare class HttpServerError extends HttpError {
206 /**
207 * @constructor
208 * @param {string=} message
209 * @param {string=} innerMessage
210 */
211 constructor(message?: string, innerMessage?: string);
212}
213/**
214 * @classdesc Extends Error object for throwing exceptions on data operations
215 * @class
216 * @property {string} code - A string that represents an error code e.g. EDATA
217 * @property {string} message - The error message.
218 * @property {string} innerMessage - The error inner message.
219 * @property {number} status - A number that represents an error status. This error status may be used for throwing the appropriate HTTP error.
220 * @augments Error
221 */
222export declare class DataError extends Error implements IStatusError, ICodeError {
223 /**
224 * Gets or sets a string which may be used to identify this error e.g. EDATA, EVIOLATION etc
225 */
226 statusCode: number;
227 /**
228 * Gets or sets a string which may be used to identify this error e.g. EDATA, EVIOLATION etc
229 */
230 code: string;
231 /**
232 * Gets or sets a string which represents the target data model, if any
233 */
234 model: string;
235 /**
236 * Gets or sets a string which represents the target data field, if any
237 */
238 field: string;
239 /**
240 * Gets or sets an inner message for this error.
241 */
242 innerMessage: string;
243 constructor(code?: string, message?: string, innerMessage?: string, model?: string, field?: string);
244}
245/**
246 * @classdesc Extends Error object for throwing not null exceptions.
247 * @class
248 * @property {string} code - A string that represents an error code. The default error code is ENULL.
249 * @property {string} message - The error message.
250 * @property {string} innerMessage - The error inner message.
251 * @property {number} status - A number that represents an error status. This error status may be used for throwing the appropriate HTTP error. The default status is 409 (Conflict)
252 * @property {string} model - The target model name
253 * @property {string} field - The target field name
254 * @augments DataError
255 */
256export declare class NotNullError extends DataError {
257 /**
258 * @constructor
259 * @param {string=} message - The error message
260 * @param {string=} innerMessage - The error inner message
261 * @param {string=} model - The target model
262 * @param {string=} field - The target field
263 */
264 constructor(message?: string, innerMessage?: string, model?: string, field?: string);
265}
266/**
267 * @classdesc Extends Error object for throwing not found exceptions.
268 * @class
269 * @property {string} code - A string that represents an error code. The default error code is EFOUND.
270 * @property {string} message - The error message.
271 * @property {string} innerMessage - The error inner message.
272 * @property {number} status - A number that represents an error status. This error status may be used for throwing the appropriate HTTP error. The default status is 404 (Conflict)
273 * @property {string} model - The target model name
274 * @augments DataError
275 */
276export declare class DataNotFoundError extends DataError {
277 /**
278 * @constructor
279 * @param {string=} message - The error message
280 * @param {string=} innerMessage - The error inner message
281 * @param {string=} model - The target model
282 */
283 constructor(message?: string, innerMessage?: string, model?: string);
284}
285/**
286 * @classdesc Extends Error object for throwing unique constraint exceptions.
287 * @class
288 * @property {string} code - A string that represents an error code. The default error code is ENULL.
289 * @property {string} message - The error message.
290 * @property {string} innerMessage - The error inner message.
291 * @property {number} status - A number that represents an error status. This error status may be used for throwing the appropriate HTTP error. The default status is 409 (Conflict)
292 * @property {string} model - The target model name
293 * @property {string} constraint - The target constraint name
294 * @augments DataError
295 */
296export declare class UniqueConstraintError extends DataError {
297 /**
298 * Gets or sets the name of the violated constraint
299 */
300 constraint: string;
301 constructor(message?: string, innerMessage?: string, model?: string, constraint?: string);
302}
303/**
304 * @classdesc Represents an access denied data exception.
305 * @class
306 *
307 * @param {string=} message - The error message
308 * @param {string=} innerMessage - The error inner message
309 * @property {string} code - A string that represents an error code. The error code is EACCESS.
310 * @property {number} status - A number that represents an error status. The error status is 401.
311 * @property {string} message - The error message.
312 * @property {string} innerMessage - The error inner message.
313 * @augments DataError
314 */
315export declare class AccessDeniedError extends DataError {
316 constructor(message?: string, innerMessage?: string);
317}