Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic errors doesn't work along with 404 errors #662

Open
angel-luis opened this issue May 4, 2024 · 1 comment
Open

Generic errors doesn't work along with 404 errors #662

angel-luis opened this issue May 4, 2024 · 1 comment

Comments

@angel-luis
Copy link

After complete the part of Handling all errors with error.tsx, if you follow the instructions of Handling 404 errors with the notFound function, you won't get any 404 page.

This is because, the docs says that this line will return an empty array:
console.log(invoice); // Invoice is an empty array []
But when the UUID doesn't exist, it throws an errors instead an empty array.

I've downloaded the template the last week so everything should be updated.

Link

https://nextjs.org/learn/dashboard-app/error-handling

@nirajanach
Copy link

nirajanach commented May 20, 2024

Yes the issue still persists as of today,

I logged on console just before notFound() in invoices/[id]/edit/page.tsx and it logged an empty array and the 404 error page rendered as it supposed to be.

if (!invoice) {
console.log('error');
notFound();
}

I am not sure how it worked but it did for me.

PS you can remove the console log afterwards and the page stays there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants