From ae1639a629e644fd9b5f5232b97a55b8b50f7447 Mon Sep 17 00:00:00 2001 From: Baroshem Date: Tue, 5 Nov 2024 08:45:47 +0100 Subject: [PATCH] feat-#247: poll log in development --- src/runtime/components/CldImage.vue | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/runtime/components/CldImage.vue b/src/runtime/components/CldImage.vue index 898c8a5..628810c 100644 --- a/src/runtime/components/CldImage.vue +++ b/src/runtime/components/CldImage.vue @@ -54,7 +54,16 @@ const handleError = async (payload: Event) => { const eventPayload = payload.target as EventTarget & { src: string } const result = await pollForProcessingImage(eventPayload) - if (result) imgKey.value = `${imgKey.value}-${Math.random()}` + if ( + typeof result.error === 'string' + && process.env.NODE_ENV === 'development' + ) { + console.error( + `[CldImage] Failed to load image ${props.src}: ${result.error}`, + ) + } + + if (result.success) imgKey.value = `${imgKey.value}-${Math.random()}` }