lucky-canvas icon indicating copy to clipboard operation
lucky-canvas copied to clipboard

Catch Error when render SlotMachine not load image

Open tungnguyen741 opened this issue 2 years ago • 12 comments

I cannot rerender or catch error from SlotMachine ("@lucky-canvas/react": "^0.1.13") although img correct link but // error: prizes[i].imgs[i] => 'my-correct-link-image' 图片加载失败', i try onFinally or onError not working for me.!

Screenshot 2023-08-15 at 17 15 53

tungnguyen741 avatar Aug 15 '23 10:08 tungnguyen741

That onFinally can only be used to capture errors in the component itself It cannot be used to capture lucky-canvas errors

buuing avatar Aug 15 '23 10:08 buuing

You need to describe what you specifically want to do

buuing avatar Aug 15 '23 10:08 buuing

i want catch error when "error: prizes[i].imgs[i] => 'my-correct-link-image' 图片加载失败' ", onError not working for me :(

tungnguyen741 avatar Aug 15 '23 10:08 tungnguyen741

If you see this error: prizes[i].imgs[i] => 'my-correct-link-image' 图片加载失败' That means there is a problem with your image path, or it is an unresolved image. This is an internal error thrown by me because you must solve it to run the lucky-canvas component correctly

buuing avatar Aug 15 '23 10:08 buuing

i sure this link correct, but i get error above (when i click link from error, it still exaclty) ;(

tungnguyen741 avatar Aug 15 '23 10:08 tungnguyen741

Send me the link and I'll take a look

buuing avatar Aug 15 '23 10:08 buuing

this error happens sometimes, i cannot send link because this link private and had to account ;(

tungnguyen741 avatar Aug 15 '23 10:08 tungnguyen741

That could be because this link cannot be accessed by my component The internal rendering of my component is like this

const img new window.Image()
img.src = 'your link'
img.onload = () => {}
img.onerror = () => {}

You can try it directly in your code

buuing avatar Aug 15 '23 10:08 buuing

Thank you, i try reproduce and report it later 👍

tungnguyen741 avatar Aug 15 '23 10:08 tungnguyen741

hi @buuing, i has been reproduce it with specific device:

z4749597129804_e2dbe040cbbd4c40c723c217b30ab1a3

device info:

  • iPhone 14 Pro Max
  • iOS 16.6.1

https://codesandbox.io/s/mutable-currying-6n6ht5

tungnguyen741 avatar Oct 03 '23 09:10 tungnguyen741

  • iPhone 14 Pro Max not render image

tungnguyen741 avatar Oct 03 '23 10:10 tungnguyen741

  • on web and iPhone 11, android working image

tungnguyen741 avatar Oct 03 '23 10:10 tungnguyen741