You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Page throws an error with err.name = "PermissionDeniedError"
Error component receives error name unchanged: err.name = "PermissionDeniedError"
Which area(s) are affected? (Select all that apply)
Runtime
Which stage(s) are affected? (Select all that apply)
Vercel (Deployed)
Additional context
I want to render different illustration and localised error message in my error.tsx depending on the error type. The issue is that there is no way to differentiate errors except by analyzing the error message itself, which is often dynamic and prone to changes overtime.
Currently I have to do something like err.message.includes("permission denied") || err.message.includes("access denied") || err.message.includes("forbidden") which is messy to say the least.
The text was updated successfully, but these errors were encountered:
Everything is much worse, in prod all errors are opaque there is not even message to check. Now it makes much more sense that all i see is a generic error screen in production, even if the error is as trivial as "Unauthenticated" 🤦
I stumbled at #49506, bottom line there is no solution except to add error handling code on every page.
Link to the code that reproduces this issue
https://github.com/skolodyazhnyy/nextjs-error-name-overridden
To Reproduce
npm run dev
/demo
pageCurrent vs. Expected behavior
Current behavior:
err.name = "PermissionDeniedError"
err.name
as"Error"
Expected behavior:
err.name = "PermissionDeniedError"
err.name = "PermissionDeniedError"
Which area(s) are affected? (Select all that apply)
Runtime
Which stage(s) are affected? (Select all that apply)
Vercel (Deployed)
Additional context
I want to render different illustration and localised error message in my
error.tsx
depending on the error type. The issue is that there is no way to differentiate errors except by analyzing the error message itself, which is often dynamic and prone to changes overtime.Currently I have to do something like
err.message.includes("permission denied") || err.message.includes("access denied") || err.message.includes("forbidden")
which is messy to say the least.The text was updated successfully, but these errors were encountered: