refactor(server): notify url when fetch error

This commit is contained in:
tamaina 2023-01-17 17:12:41 +00:00
parent d456308653
commit 79212bbd37

View File

@ -125,7 +125,7 @@ export class UndiciFetcher {
...(options.headers ?? {}), ...(options.headers ?? {}),
}, },
}).catch((err) => { }).catch((err) => {
this.logger?.error('fetch error', err); this.logger?.error(`fetch error to ${typeof url === 'string' ? url : url.href}`, err);
throw new StatusError('Resource Unreachable', 500, 'Resource Unreachable'); throw new StatusError('Resource Unreachable', 500, 'Resource Unreachable');
}); });
if (!res.ok && !privateOptions.noOkError) { if (!res.ok && !privateOptions.noOkError) {