website-v2 icon indicating copy to clipboard operation
website-v2 copied to clipboard

Document that layout/error.vue is a special case

Open Soviut opened this issue 4 years ago • 1 comments

Is your feature request related to a problem? Please describe.

We needed to make a custom error page for a special case in our app (something that doesn't fall into the normal bounds of 4xx errors). After reading the docs on layouts, I thought it would be a good idea to create a layouts/error.vue layout and apply it with layout: 'error' to our custom message.

I thought this would kill two birds with one stone, creating an on-brand error page template and being able to reuse it for our custom error page. Unfortunately, this did not seem to work and it used the default layout instead.

This behaviour appears to be a special case where the error layout only works with 4xx errors.

Describe the solution you'd like

The documentation should mention that this is a special case and that the layout cannot be used in other pages. Make it clear that it only can wrap the 4xx errors.

Describe alternatives you've considered

We instead duplicated layouts/error.vue to layouts/empty.vue and set layout; 'empty' in the page.

Additional context

Alternatively, it would be nice if the error layout could be used anywhere, but documentation takes less effort for now.

Soviut avatar Mar 25 '21 06:03 Soviut

@Soviut PRs definitely welcome to improve the docs :grinning: However, I'm not sure that's correct - you can return other errors using error (see docs) which trigger this page being shown.

danielroe avatar Mar 25 '21 16:03 danielroe