mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-27 17:33:10 +02:00
14 lines
443 B
TypeScript
14 lines
443 B
TypeScript
|
export class StatusError extends Error {
|
||
|
public statusCode: number;
|
||
|
public statusMessage?: string;
|
||
|
public isClientError: boolean;
|
||
|
|
||
|
constructor(message: string, statusCode: number, statusMessage?: string) {
|
||
|
super(message);
|
||
|
this.name = 'StatusError';
|
||
|
this.statusCode = statusCode;
|
||
|
this.statusMessage = statusMessage;
|
||
|
this.isClientError = typeof this.statusCode === 'number' && this.statusCode >= 400 && this.statusCode < 500;
|
||
|
}
|
||
|
}
|