mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 20:44:34 +00:00
recognize FetchError as retryable
This commit is contained in:
parent
a10885ae95
commit
f2033ecdc6
1 changed files with 2 additions and 1 deletions
|
@ -3,7 +3,7 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { AbortError } from 'node-fetch';
|
import { AbortError, FetchError } from 'node-fetch';
|
||||||
import { UnrecoverableError } from 'bullmq';
|
import { UnrecoverableError } from 'bullmq';
|
||||||
import { StatusError } from '@/misc/status-error.js';
|
import { StatusError } from '@/misc/status-error.js';
|
||||||
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||||
|
@ -17,6 +17,7 @@ export function isRetryableError(e: unknown): boolean {
|
||||||
if (e instanceof IdentifiableError) return e.isRetryable;
|
if (e instanceof IdentifiableError) return e.isRetryable;
|
||||||
if (e instanceof UnrecoverableError) return false;
|
if (e instanceof UnrecoverableError) return false;
|
||||||
if (e instanceof AbortError) return true;
|
if (e instanceof AbortError) return true;
|
||||||
|
if (e instanceof FetchError) return true;
|
||||||
if (e instanceof Error) return e.name === 'AbortError';
|
if (e instanceof Error) return e.name === 'AbortError';
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue