Fix: Handle Null JSON Body in Spotify API Response - #8752
Conversation
|
This pull request addresses the issue of handling null JSON bodies in the Spotify API response, which is crucial for maintaining the robustness of our application. Similar past decisions have focused on improving error handling in the Spotify integration, ensuring that we gracefully manage unexpected API responses. Thank you for your contribution, and please let me know if you need any further assistance! |
📦 Next.js Bundle Size Report (Gzipped Sizes)✨ No significant bundle size changes detected. 📊 Summary of Totals
|
Aamod007
left a comment
There was a problem hiding this comment.
Good defensive programming! Wrapping the
esponse.json()\ call in a try-catch block inside \services/spotify/api.ts\ is exactly the right approach to gracefully handle cases where the Spotify API returns a 204 No Content or a malformed JSON response. It prevents unhandled promise rejections. Looks solid.
Description
Added try-catch around
response.json()inservices/spotify/api.ts.Pillar
Checklist
CONTRIBUTING.mdfile.Note
Please assign this PR to the
tmdeveloper007account.Closes #8684