fix: return JSON instead of plain text on theme-comparison error#200
Conversation
|
@bh462007 is attempting to deploy a commit to the Dot_NotSam's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR updates the error response format for the theme preview endpoint to return JSON instead of plain text on server errors.
Changes:
- Switches the
500response fromsend()with a string tojson()with anerrorfield.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } catch (error) { | ||
| console.error('Theme preview render failed:', error.message); | ||
| res.status(500).send('Error rendering theme preview'); | ||
| res.status(500).json({ error: 'Error rendering theme preview'}); |
|
🎉 Congratulations @bh462007! 🎉 Your pull request has been successfully merged into samdev-pulse! Thank you so much for your valuable contribution and effort. Every single improvement helps make samdev-pulse a better profile experience for everyone! 🙌 🚀 What's Next?
💬 Stay Connected: Thank you again, and keep up the amazing work! 💻✨ |
Summary
This PR fixes an inconsistency in the error response format of the theme comparison route.
Previously, internal server errors in
theme-comparison.route.jsreturned a plain text response using.send(), while the rest of the API follows a JSON-based response structure for both successful and failed requests. This could lead to inconsistent handling on the client side and makes the API contract less predictable.Closes #193
Changes Made
src/routes/theme-comparison.route.jsapplication/jsoncontent typeExample
Before
After
Why This Change?
Testing
There are currently no automated tests covering this route.
Manually verified that:
application/jsoncontent typeType of Change