-
Notifications
You must be signed in to change notification settings - Fork 324
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
chore: log xhr error #1121
base: main
Are you sure you want to change the base?
chore: log xhr error #1121
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
WalkthroughThe pull request introduces modifications to the error handling logic in the Changes
Sequence DiagramsequenceDiagram
participant Client
participant UploadFunction
participant XMLHttpRequest
participant ErrorHandler
Client->>UploadFunction: Initiate file upload
UploadFunction->>XMLHttpRequest: Send upload request
alt Upload Successful
XMLHttpRequest-->>UploadFunction: Upload progress/complete
else Upload Fails
XMLHttpRequest->>ErrorHandler: Trigger error event
ErrorHandler->>ErrorHandler: Log error details
ErrorHandler-->>UploadFunction: Return error information
end
This sequence diagram illustrates the updated error handling flow, showing how the error event is now captured and logged when an upload fails, providing more visibility into potential issues during the file upload process. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
More templates
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/uploadthing/src/_internal/upload-browser.ts (1)
66-68
: Include more details in the thrown error and switch to console.error for clarity.Currently, the error event is logged, but the
UploadThingError
does not include any details fromerr
. Providing at least theerr.message
in the thrown error can drastically improve debugging. Also, usingconsole.error
is more expressive and consistent for reporting errors.Here’s a suggested diff for lines 66-68:
xhr.addEventListener("error", (err) => { - // eslint-disable-next-line no-console - console.log("XHR error", err, xhr); + // eslint-disable-next-line no-console + console.error("XHR error", err, xhr); resume( new UploadThingError({ code: "UPLOAD_FAILED", + message: err?.message || "Unknown XHR error", }), ); });
📦 Bundle size comparison
|
Summary by CodeRabbit