frandiox / vite-ssr

Use Vite for server side rendering in Node
MIT License
829 stars 92 forks source link

Throw and catch errors? #165

Open lautiamkok opened 2 years ago

lautiamkok commented 2 years ago

How do we throw and catch errors with this plugin?

For example, if I throw an error on a page:

// about.vue
const { data } = await useFetch(`/contact`)
if (data === null) {
  throwError('No data!', 500)
}

How can we catch that error with vite-ssr?