mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-12 13:27:31 -08:00
fix(core): Improve axios error handling in nodes (#5891)
This commit is contained in:
parent
6d5c35d17f
commit
f0a51a0b76
|
@ -707,7 +707,7 @@ async function proxyRequestToAxios(
|
||||||
|
|
||||||
const message = `${response.status as number} - ${JSON.stringify(responseData)}`;
|
const message = `${response.status as number} - ${JSON.stringify(responseData)}`;
|
||||||
throw Object.assign(new Error(message, { cause: error }), {
|
throw Object.assign(new Error(message, { cause: error }), {
|
||||||
status: response.status,
|
statusCode: response.status,
|
||||||
options: pick(config ?? {}, ['url', 'method', 'data', 'headers']),
|
options: pick(config ?? {}, ['url', 'method', 'data', 'headers']),
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1310,7 +1310,7 @@ export class HttpRequestV3 implements INodeType {
|
||||||
if (autoDetectResponseFormat && response.reason.error instanceof Buffer) {
|
if (autoDetectResponseFormat && response.reason.error instanceof Buffer) {
|
||||||
response.reason.error = Buffer.from(response.reason.error as Buffer).toString();
|
response.reason.error = Buffer.from(response.reason.error as Buffer).toString();
|
||||||
}
|
}
|
||||||
throw new NodeApiError(this.getNode(), response as JsonObject);
|
throw new NodeApiError(this.getNode(), response.reason as JsonObject);
|
||||||
} else {
|
} else {
|
||||||
// Return the actual reason as error
|
// Return the actual reason as error
|
||||||
returnItems.push({
|
returnItems.push({
|
||||||
|
|
Loading…
Reference in a new issue