forked from exceptionless/Exceptionless.JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSubmissionResponse.ts
More file actions
24 lines (22 loc) · 873 Bytes
/
SubmissionResponse.ts
File metadata and controls
24 lines (22 loc) · 873 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
export class SubmissionResponse {
public success: boolean = false;
public badRequest: boolean = false;
public serviceUnavailable: boolean = false;
public paymentRequired: boolean = false;
public unableToAuthenticate: boolean = false;
public notFound: boolean = false;
public requestEntityTooLarge: boolean = false;
public statusCode: number;
public message: string;
constructor(statusCode: number, message?: string) {
this.statusCode = statusCode;
this.message = message;
this.success = statusCode >= 200 && statusCode <= 299;
this.badRequest = statusCode === 400;
this.serviceUnavailable = statusCode === 503;
this.paymentRequired = statusCode === 402;
this.unableToAuthenticate = statusCode === 401 || statusCode === 403;
this.notFound = statusCode === 404;
this.requestEntityTooLarge = statusCode === 413;
}
}