How to handle HTTP error codes (404) on the frontend-side in Nuxt 3?

Viewed 356
1 Answers

SPA

Writing an error.vue-file inside the root-folder works and the error object can be passed as prop to this component. The object as the following type:

error: { 
  url: string; 
  statusCode: string; 
  statusMessage: string; 
  message: string; 
  description: string; 
  data: any; 
}

Multiple pages

Create a 404.vue-file inside the root-folder

Related