Skip to content
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

fix: Fix error handling Update index.ts #2476

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

brawncode
Copy link

@brawncode brawncode commented Jan 19, 2025

Why is this change needed?

The error handling in the userdata fetch block assumes the error object always has a response property, which isn't guaranteed. This can cause crashes if the error is unrelated to an HTTP request (e.g., network issues or code errors).

I've updated the console.error statement to safely handle cases where e.response is undefined. Now it logs either the response data or the error message, preventing potential runtime errors.

Merge Checklist

Choose all relevant options below by adding an x now or at any time before submitting for review


PR-Codex overview

This PR improves error handling in the packages/hub-web/examples/profile/index.ts file by making the error logging more robust. It adds a fallback to log the error message if the response data is not available.

Detailed summary

  • Updated the error logging in the catch block.
  • Changed console.error to log e.response?.data or fallback to e.message if e.response.data is undefined.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Copy link

vercel bot commented Jan 19, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hub-monorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 19, 2025 6:03pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant