mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2024-12-17 06:59:01 +01:00
c1514ce91d
Fix #13290
20 lines
646 B
TypeScript
20 lines
646 B
TypeScript
/*
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
export class StatusError extends Error {
|
|
public statusCode: number;
|
|
public statusMessage?: string;
|
|
public isClientError: boolean;
|
|
public isRetryable: 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;
|
|
this.isRetryable = !this.isClientError || this.statusCode === 429;
|
|
}
|
|
}
|