From 321cf2e40035bac9d23ea2fb86240a7d989d9b15 Mon Sep 17 00:00:00 2001 From: Santeri Horttanainen Date: Wed, 31 Mar 2021 16:04:39 +0300 Subject: [PATCH] Stop passing events to Promise.reject image.onerror is passed an event, not an error: https://github.com/getsentry/sentry-javascript/issues/2546#issuecomment-703331367 https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement --- src/LazyImageFull.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LazyImageFull.tsx b/src/LazyImageFull.tsx index ddd0bfe..b702d95 100644 --- a/src/LazyImageFull.tsx +++ b/src/LazyImageFull.tsx @@ -390,7 +390,7 @@ const loadImage = ( } image.onload = resolve; - image.onerror = reject; + image.onerror = event => reject(new Error(`Failed to load: ${src}`)); }); /** Promise that resolves after a specified number of ms */