How to return a real error with the status in the server component?
Unanswered
Great Dane posted this in #help-forum
Great DaneOP
Hello! In my server component I use the construction from docs:
If the record is deleted from the database, the client gives an error page with white screen and text like: "Application error: a server-side exception has occurred ...". OK this is an error page but it gives 200 ok.
Some pages may be deleted after time. Does it mean that Google will index the unexisting page?
I want the deleted pages (previously created and indexed) be deleted from Google index. As I understand, the robot should recieve an error (not 200 ok yeah?). How to handle the situation correctly?
My website is not deployed on Vercel, it works on VPS, Nginx, Ubuntu etc.
Excuse me if the question is trivial. Thanks for attention.
const res = await fetch('https://api.example.com/...')
// The return value is *not* serialized
// You can return Date, Map, Set, etc.
if (!res.ok) {
// This will activate the closest `error.js` Error Boundary
throw new Error('Failed to fetch data')
}If the record is deleted from the database, the client gives an error page with white screen and text like: "Application error: a server-side exception has occurred ...". OK this is an error page but it gives 200 ok.
Some pages may be deleted after time. Does it mean that Google will index the unexisting page?
I want the deleted pages (previously created and indexed) be deleted from Google index. As I understand, the robot should recieve an error (not 200 ok yeah?). How to handle the situation correctly?
My website is not deployed on Vercel, it works on VPS, Nginx, Ubuntu etc.
Excuse me if the question is trivial. Thanks for attention.