c2370a1be6
* chore: Add the SPDX information to each file Add copyright and licensing information as defined in version 3.0 of the REUSE Specification. * tweak format --------- Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
18 lines
558 B
TypeScript
18 lines
558 B
TypeScript
/*
|
|
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
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;
|
|
}
|
|
}
|