fix(core): Improve handling of wrapped errors (no-changelog) (#8631)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2024-02-14 17:29:23 +01:00 committed by GitHub
parent 100d9bc087
commit 2b9391a975
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 7 deletions

View file

@ -45,8 +45,7 @@ export abstract class NodeError extends ExecutionBaseError {
super(message, options);
if (error instanceof NodeError) {
this.level = 'error';
this.message = `[RE-WRAPPED]: ${message}`;
this.tags.reWrapped = true;
}
}

View file

@ -10,7 +10,7 @@ export type ReportingOptions = {
export class ApplicationError extends Error {
level: Level;
readonly tags?: Event['tags'];
readonly tags: NonNullable<Event['tags']>;
readonly extra?: Event['extra'];

View file

@ -13,10 +13,10 @@ describe('NodeError', () => {
const wrapped2 = new NodeOperationError(node, opsError);
expect(wrapped1.level).toEqual('error');
expect(wrapped1.message).toEqual(
'[RE-WRAPPED]: The service was not able to process your request',
);
expect(wrapped1.message).toEqual('The service was not able to process your request');
expect(wrapped1.tags).toEqual(expect.objectContaining({ reWrapped: true }));
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 }));
});
});