Skip to content

Commit

Permalink
fix(core): Better errors for common status codes fix
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-radency authored May 3, 2023
1 parent 570790e commit 700cc39
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 8 additions & 3 deletions packages/workflow/src/NodeErrors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,12 +316,17 @@ export class NodeApiError extends NodeError {
(error?.reason as IDataObject)?.description) as string;
}

if (!httpCode && !message && error.status === 'rejected') {
if (
!httpCode &&
!message &&
this.message &&
this.message.toUpperCase().includes('ECONNREFUSED')
) {
httpCode = 'ECONNREFUSED';

const originalMessage = this.message;
if (!description && originalMessage) {
this.description = `${originalMessage} ${this.description ?? ''}`;
if (!description) {
this.description = `${originalMessage}; ${this.description ?? ''}`;
}
}

Expand Down
1 change: 0 additions & 1 deletion packages/workflow/test/NodeErrors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ describe('NodeErrors tests', () => {

it('should return default message for ECONNREFUSED', () => {
const nodeApiError = new NodeApiError(node, {
status: 'rejected',
message: 'ECONNREFUSED',
});

Expand Down

0 comments on commit 700cc39

Please sign in to comment.