Skip to content

Commit

Permalink
fix(core): Ensure AxiosError status always gets copied over to NodeAp…
Browse files Browse the repository at this point in the history
…iError (n8n-io#8509)
  • Loading branch information
netroy authored Feb 2, 2024
1 parent 4fed68e commit 76c5a62
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/workflow/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"@n8n/tournament": "1.0.2",
"@n8n_io/riot-tmpl": "4.0.0",
"ast-types": "0.15.2",
"axios": "1.6.7",
"callsites": "3.1.0",
"deep-equal": "2.2.0",
"esprima-next": "5.8.4",
Expand Down
5 changes: 5 additions & 0 deletions packages/workflow/src/errors/node-api.error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import type {
import { NodeError } from './abstract/node.error';
import { removeCircularRefs } from '../utils';
import type { ReportingOptions } from './application.error';
import { AxiosError } from 'axios';

export interface NodeOperationErrorOptions {
message?: string;
Expand Down Expand Up @@ -127,6 +128,10 @@ export class NodeApiError extends NodeError {
) {
super(node, errorResponse);

if (!httpCode && errorResponse instanceof AxiosError) {
httpCode = errorResponse.response?.status?.toString();
}

// only for request library error
if (errorResponse.error) {
removeCircularRefs(errorResponse.error as JsonObject);
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 76c5a62

Please sign in to comment.