mirror of
https://github.com/n8n-io/n8n.git
synced 2024-09-20 06:47:32 -07:00
fix(core): Improve handling of wrapped errors (no-changelog) (#8631)
This commit is contained in:
parent
100d9bc087
commit
2b9391a975
|
@ -45,8 +45,7 @@ export abstract class NodeError extends ExecutionBaseError {
|
||||||
super(message, options);
|
super(message, options);
|
||||||
|
|
||||||
if (error instanceof NodeError) {
|
if (error instanceof NodeError) {
|
||||||
this.level = 'error';
|
this.tags.reWrapped = true;
|
||||||
this.message = `[RE-WRAPPED]: ${message}`;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ export type ReportingOptions = {
|
||||||
export class ApplicationError extends Error {
|
export class ApplicationError extends Error {
|
||||||
level: Level;
|
level: Level;
|
||||||
|
|
||||||
readonly tags?: Event['tags'];
|
readonly tags: NonNullable<Event['tags']>;
|
||||||
|
|
||||||
readonly extra?: Event['extra'];
|
readonly extra?: Event['extra'];
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,10 @@ describe('NodeError', () => {
|
||||||
const wrapped2 = new NodeOperationError(node, opsError);
|
const wrapped2 = new NodeOperationError(node, opsError);
|
||||||
|
|
||||||
expect(wrapped1.level).toEqual('error');
|
expect(wrapped1.level).toEqual('error');
|
||||||
expect(wrapped1.message).toEqual(
|
expect(wrapped1.message).toEqual('The service was not able to process your request');
|
||||||
'[RE-WRAPPED]: The service was not able to process your request',
|
expect(wrapped1.tags).toEqual(expect.objectContaining({ reWrapped: true }));
|
||||||
);
|
|
||||||
expect(wrapped2.level).toEqual('error');
|
expect(wrapped2.level).toEqual('error');
|
||||||
expect(wrapped2.message).toEqual('[RE-WRAPPED]: Some operation failed');
|
expect(wrapped2.message).toEqual('Some operation failed');
|
||||||
|
expect(wrapped2.tags).toEqual(expect.objectContaining({ reWrapped: true }));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue