T
TanStack13mo ago
national-gold

How to handle server 500 error?

I want to show separate screen for 500 api response. I made listner for listening for 404 response and when detected i just do:
throw notFound({ routeId: '/_authorized/app' });
throw notFound({ routeId: '/_authorized/app' });
How i can do the same but with 500 api?
5 Replies
extended-yellow
extended-yellow13mo ago
is this router or start?
national-gold
national-goldOP13mo ago
router
extended-yellow
extended-yellow13mo ago
hm but can't you just show an error? what's your question exactly?
national-gold
national-goldOP13mo ago
is it possible to trigger manually a defaultErrorComponent declared in createRouter options? I could show this component when my server response with 500 code
extended-yellow
extended-yellow13mo ago
if your loader throws an error then the error component should be shown

Did you find this page helpful?