-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): Prevent NodeErrors from being wrapped multiple times (#8301)
- Loading branch information
Showing
2 changed files
with
25 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { mock } from 'jest-mock-extended'; | ||
import type { INode } from '@/Interfaces'; | ||
import { NodeApiError } from '@/errors/node-api.error'; | ||
import { NodeOperationError } from '@/errors/node-operation.error'; | ||
|
||
describe('NodeError', () => { | ||
const node = mock<INode>(); | ||
|
||
it('should prevent errors from being re-wrapped', () => { | ||
const apiError = new NodeApiError(node, mock({ message: 'Some error happened', code: 500 })); | ||
const opsError = new NodeOperationError(node, mock()); | ||
|
||
expect(new NodeOperationError(node, apiError)).toEqual(apiError); | ||
expect(new NodeOperationError(node, opsError)).toEqual(opsError); | ||
}); | ||
}); |