N
Nuxt11mo ago
oemer

How can i catch a @nuxt/image error from ipx?

I tried to use @error on NuxtImg and <NuxtErrorBoundary> component, but nothing works..
<template>
<nuxt-error-boundary @error="handleError">
<nuxt-img
@error="handleError"
@load="handleLoad"
:src="url"
/>
<template #error="{ error }">
<p>An error occurred: {{ error }}</p>
</template>
</nuxt-error-boundary>
</template>

<script lang="ts" setup>
const handleError = (e) => {
// never gets printed, even if no image is displayed
console.log("error", e)
}

const handleLoad = (e) => {
// gets printed when image is loaded successfully
console.log("load", e)
}
</script>
<template>
<nuxt-error-boundary @error="handleError">
<nuxt-img
@error="handleError"
@load="handleLoad"
:src="url"
/>
<template #error="{ error }">
<p>An error occurred: {{ error }}</p>
</template>
</nuxt-error-boundary>
</template>

<script lang="ts" setup>
const handleError = (e) => {
// never gets printed, even if no image is displayed
console.log("error", e)
}

const handleLoad = (e) => {
// gets printed when image is loaded successfully
console.log("load", e)
}
</script>
Here is the full IPX error (see also screenshot):
{
"error": {
"message": "[400] [IPX_INVALID_IMAGE] Cannot parse image metadata: http://localhost:4566/<image-url>"
}
}
{
"error": {
"message": "[400] [IPX_INVALID_IMAGE] Cannot parse image metadata: http://localhost:4566/<image-url>"
}
}
No description
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server