Nested _error.html pages #476
Description
Just a thought, for now — haven't yet considered all the ramifications of this, but wanted to get it out of my head since I'm dealing with it right now.
There are lots of times when you might want to show an error page that is specific to the route where the error occurred. For example, /products/non-existent-product
and /blog/non-existent-post
might both be 404s, but would probably be completely different.
At present, there's a single src/routes/_error.html
page (which could perhaps be optional, the way src/routes/_layout.html
is?). If instead (or in addition) there were src/routes/products/_error.html
and src/routes/blog/_error.html
pages, it would be much easier to differentiate them.
One complication: if the error came from src/routes/blog/[slug].html
, it's likely that src/routes/blog/_error.html
would know what to do with the error it was passed, but if the error came from (say) src/routes/_layout.html
, it might well not know what to do. It's possible therefore that Sapper should choose to use the error component 'closest' to the source of the error.