forked from samchon/backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHttpError.ts
More file actions
33 lines (30 loc) · 861 Bytes
/
Copy pathHttpError.ts
File metadata and controls
33 lines (30 loc) · 861 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/**
* @packageDocumentation
* @module api
*/
//================================================================
/**
* HTTP Error from the backend server.
*
* @author Jeongho Nam - https://github.com/samchon
*/
export class HttpError extends Error
{
public readonly method: string;
public readonly path: string;
public readonly status: number;
public constructor(method: string, path: string, status: number, message: string)
{
super(message);
// INHERITANCE POLYFILL
const proto: HttpError = new.target.prototype;
if (Object.setPrototypeOf)
Object.setPrototypeOf(this, proto);
else
(this as any).__proto__ = proto;
// ASSIGN MEMBERS
this.method = method;
this.path = path;
this.status = status;
}
}