2023-07-27 14:31:52 +09:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2022-09-18 03:27:08 +09:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|