triggerdotdev / jsonhero-web

JSON Hero is an open-source, beautiful JSON explorer for the web that lets you browse, search and navigate your JSON files at speed. 🚀. Built with 💜 by the Trigger.dev team.
https://jsonhero.io
Apache License 2.0
9.01k stars 482 forks source link

Improve error handling #187

Open azzzy opened 1 month ago

azzzy commented 1 month ago

When JSON Hero fails to fetch a json for some reason it throws an error, which is outside of any catch/error boundary. In this case safeFetch returns a response with HTTP status 520 send from the remote server.

Screenshot 2024-06-01 at 16 24 16

The first commit fixes this problem: fix: don't try to access the title if doc is undefined

The second adds the display of the actual errors coming from safeFetch: fix: show the fetch errors when thrown, instead of hardcoded 404