T
TanStack10mo ago
fascinating-indigo

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
deep-jade
deep-jade10mo ago
is this router or start?
fascinating-indigo
fascinating-indigoOP10mo ago
router
deep-jade
deep-jade10mo ago
hm but can't you just show an error? what's your question exactly?
fascinating-indigo
fascinating-indigoOP10mo 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
deep-jade
deep-jade10mo ago
if your loader throws an error then the error component should be shown

Did you find this page helpful?