Skip to content

Commit 768ef7e

Browse files
committed
fix(node-core): ignore vercel AbortError by default on unhandled rejection
1 parent 3e6d0dd commit 768ef7e

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

dev-packages/node-integration-tests/suites/public-api/onUnhandledRejectionIntegration/ignore-default.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,18 @@ class AI_NoOutputGeneratedError extends Error {
1313
}
1414
}
1515

16+
class AbortError extends Error {
17+
constructor(message) {
18+
super(message);
19+
this.name = 'AbortError';
20+
}
21+
}
22+
1623
setTimeout(() => {
1724
process.stdout.write("I'm alive!");
1825
process.exit(0);
1926
}, 500);
2027

21-
// This should be ignored by default and not produce a warning
28+
// These should be ignored by default and not produce a warning
2229
Promise.reject(new AI_NoOutputGeneratedError('Stream aborted'));
30+
Promise.reject(new AbortError('Stream aborted'));

dev-packages/node-integration-tests/suites/public-api/onUnhandledRejectionIntegration/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ test rejection`);
179179
expect(transactionEvent!.contexts!.trace!.span_id).toBe(errorEvent!.contexts!.trace!.span_id);
180180
});
181181

182-
test('should not warn when AI_NoOutputGeneratedError is rejected (default ignore)', () =>
182+
test('should not warn when AI_NoOutputGeneratedError or AbortError is rejected (default ignore)', () =>
183183
new Promise<void>(done => {
184184
expect.assertions(3);
185185

packages/node-core/src/integrations/onunhandledrejection.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@ const INTEGRATION_NAME = 'OnUnhandledRejection';
2727

2828
const DEFAULT_IGNORES: IgnoreMatcher[] = [
2929
{
30-
name: 'AI_NoOutputGeneratedError', // When stream aborts in Vercel AI SDK, Vercel flush() fails with an error
30+
name: 'AI_NoOutputGeneratedError', // When stream aborts in Vercel AI SDK V5, Vercel flush() fails with an error
3131
},
32+
{
33+
name: 'AbortError', // When stream aborts in Vercel AI SDK V6
34+
}
3235
];
3336

3437
const _onUnhandledRejectionIntegration = ((options: Partial<OnUnhandledRejectionOptions> = {}) => {

0 commit comments

Comments
 (0)