N
Nuxt3mo ago
cosbgn

fetch full screen error on production

I use a custom fetch:
export const $api = $fetch.create({
async onResponseError({ response }) {
const possibilities = [response?._data?.statusMessage, response?.error?.data?.statusMessage, response?._data?.message, response.message, response?.statusText, "Unknown Server Error"]
const withData = possibilities.filter(f => f?.length)
const err_msg = `${response.status}: ${withData[0]}`
if (import.meta.browser){
toast(err_msg, "error")
} else {
console.error(err_msg)
}
}
})
export const $api = $fetch.create({
async onResponseError({ response }) {
const possibilities = [response?._data?.statusMessage, response?.error?.data?.statusMessage, response?._data?.message, response.message, response?.statusText, "Unknown Server Error"]
const withData = possibilities.filter(f => f?.length)
const err_msg = `${response.status}: ${withData[0]}`
if (import.meta.browser){
toast(err_msg, "error")
} else {
console.error(err_msg)
}
}
})
This works super well on dev, when an error shows it simply shows the toast. On production instead it shows the toast but also the full screen nuxt-error. How can I get that fixed?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server