mirror of
https://github.com/samuelthomas2774/nxapi.git
synced 2026-07-13 14:51:10 -05:00
Fix handling timeouts as a temporary error
This commit is contained in:
parent
95fb4b57d8
commit
0a17dd3cf0
|
|
@ -1,4 +1,5 @@
|
|||
import createDebug from 'debug';
|
||||
import { AbortError } from 'node-fetch';
|
||||
import Loop, { LoopResult } from './loop.js';
|
||||
import { CoralErrorResponse } from '../api/coral-types.js';
|
||||
import { ErrorResponse } from '../api/util.js';
|
||||
|
|
@ -32,6 +33,10 @@ export async function handleError(
|
|||
if (TemporaryErrorSymbol in err && err[TemporaryErrorSymbol]) {
|
||||
debug('Temporary error, waiting %ds before retrying', loop.update_interval, err);
|
||||
|
||||
return LoopResult.OK;
|
||||
} else if (err instanceof AbortError) {
|
||||
debug('Request aborted (timeout?), waiting %ds before retrying', loop.update_interval, err);
|
||||
|
||||
return LoopResult.OK;
|
||||
} else if ('code' in err && (err as any).type === 'system' && err.code && err.code in temporary_system_errors) {
|
||||
const desc = temporary_system_errors[err.code as keyof typeof temporary_system_errors];
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user