Giter Site home page Giter Site logo

Comments (4)

appdcs avatar appdcs commented on August 21, 2024 1

Alright, so I have changed the title of this issue to better represent my current understanding of how these pages work.

That 'fallback error page', which is not to be confused with the Error Page (i.e.: error.vue), is handled by the configured Nitro error handler.

As per https://vuejs.org/api/application.html#app-config-errorhandler, https://nuxt.com/docs/getting-started/error-handling#vue-errors and https://nitro.unjs.io/config#errorhandler, a new error handler can be provided in nuxt.config.js.

I truly couldn't find an example online, so I took upon myself to try it on this online code editor: https://stackblitz.com/edit/github-bf8y4g-7iqjdn?file=server%2Ferror.ts

This is the result:
image

Hopefully this helps someone else.


The new request for this issue:
Nuxt team, it would be fantastic if the page templates imported in /packages/nuxt/src/core/runtime/nitro/error.ts#L67 could be provided directly in nuxt.config.json

from nuxt.js.

stackblitz avatar stackblitz commented on August 21, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

from nuxt.js.

danielroe avatar danielroe commented on August 21, 2024

If there is an error rendering the error page then we fall back to a static page. Your middleware means that it throws an error even when rendering the error page. Check the page route/path first.

from nuxt.js.

appdcs avatar appdcs commented on August 21, 2024

Hi @danielroe, thank you for your comment.
Could you please clarify what you mean by "Check the page route/path first" ?

That middleware is causing an error on purpose, outside of any pages.

What I was trying to point out is that the fallback error page we see pictured in my first comment, and linked in the reproduction Stackblitz, is not related to error.vue, and even if editable in some way, not documented on the Nuxt website.

Those fallback templates are provided by @nuxt/ui-templates (https://github.com/nuxt/nuxt/tree/main/packages/ui-templates).

Also seems to be imported here: https://github.com/nuxt/nuxt/blob/main/packages/nuxt/src/core/runtime/nitro/error.ts#L67
How can I customize those fallback error page templates?

Thank you

from nuxt.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.