Skip to content

Add comprehensive error handling to API calls#9

Open
jaiswalsachin49 wants to merge 1 commit intoanna-dahlberg:devfrom
jaiswalsachin49:add-error-handling
Open

Add comprehensive error handling to API calls#9
jaiswalsachin49 wants to merge 1 commit intoanna-dahlberg:devfrom
jaiswalsachin49:add-error-handling

Conversation

@jaiswalsachin49
Copy link
Copy Markdown

Fixes #4 - Add Proper Error Handling for API Calls

Changes Made:

  • ✅ Added comprehensive try/catch blocks to both JavaScript files
  • ✅ Implemented user-friendly error messages with emojis
  • ✅ Added console logging for debugging purposes
  • ✅ Ensured button state resets even when API calls fail
  • ✅ Enhanced input validation feedback for lucky number page

Error Scenarios Handled:

  • Network offline/connectivity issues
  • API returns 404 for invalid advice slip IDs
  • API temporarily unavailable (HTTP errors)
  • Malformed JSON responses
  • Invalid lucky number inputs

Testing:

  • Verified error handling works for different scenarios
  • Button state properly resets in all cases
  • User sees friendly error messages instead of broken functionality
  • Console provides detailed logging for debugging

- Add try/catch blocks for network and API errors
- Display user-friendly error messages with emojis
- Handle specific error scenarios (network offline, 404, malformed JSON)
- Add console logging for debugging
- Ensure button state is reset even when errors occur
- Improve input validation feedback for lucky number page

Fixes anna-dahlberg#4
@vercel
Copy link
Copy Markdown

vercel bot commented Sep 6, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
need-some-advice Ready Ready Preview Comment Sep 6, 2025 9:47am

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.

Bug Fix - Add Proper Error Handling for API Calls

1 participant