fix: listen for error event on image (#2736)

zio/stable
Mary 2024-02-06 06:23:20 +07:00 committed by GitHub
parent 2fd4b27ec6
commit ca66fae3ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 0 deletions

View File

@ -132,6 +132,9 @@ function createResizedImage(
ctx.drawImage(img, 0, 0, w, h) ctx.drawImage(img, 0, 0, w, h)
resolve(canvas.toDataURL('image/jpeg', quality)) resolve(canvas.toDataURL('image/jpeg', quality))
}) })
img.addEventListener('error', ev => {
reject(ev.error)
})
img.src = dataUri img.src = dataUri
}) })
} }