-
-
Notifications
You must be signed in to change notification settings - Fork 272
Fix fetch client to intercept AbortError and network exceptions #2970
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
🦋 Changeset detectedLatest commit: 6a46317 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
|
@copilot run |
Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2970 +/- ##
==========================================
+ Coverage 29.40% 29.48% +0.08%
==========================================
Files 403 405 +2
Lines 35790 35841 +51
Branches 2065 2075 +10
==========================================
+ Hits 10524 10568 +44
- Misses 25239 25246 +7
Partials 27 27
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
commit: |
Fix fetch client to intercept AbortError and other fetch exceptions
Summary
Fixed an issue where the fetch client was not intercepting exceptions thrown by the fetch call, such as AbortError (when a request is aborted) and network errors. These exceptions were propagating directly to the caller without going through error interceptors, unlike HTTP errors which were properly handled.
Changes
Main Fix (
client.ts)await _fetch(request)call in a try-catch blockthrowOnErroris true, the transformed error is re-thrownTests (
client.test.ts)Added 4 comprehensive tests for exception handling:
throwOnError: true, the transformed error is thrownUpdates
Verification Results
Behavior
Before: AbortError and network errors would throw directly, bypassing error interceptors
After: All fetch exceptions are caught, passed through error interceptors, and handled consistently
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.