Open petersli opened 1 week ago
@damzobridge @bodymovin
When testing out https://github.com/rive-app/rive-react/pull/269, I realized that the errors thrown by file.init() were not actually being caught by the try/catch due to init being async.
file.init()
init
In the rive-wasm repo, in order to catch the errors thrown within the async init of the file, they use await (https://github.com/rive-app/rive-wasm/blob/6d5cd8909a635184f156be03d1f32d5ceb4025fc/js/src/rive.ts#L1739).
rive-wasm
await
Testing locally, this fixes my issue!
Before: The app still crashes if I pass a bad src to useRiveFile.
src
useRiveFile
After: If there's a bad src, the app does not crash anymore. If the src is valid, the Rive file loads and the animation plays as expected.
@damzobridge @bodymovin
When testing out https://github.com/rive-app/rive-react/pull/269, I realized that the errors thrown by
file.init()
were not actually being caught by the try/catch due toinit
being async.In the
rive-wasm
repo, in order to catch the errors thrown within the async init of the file, they useawait
(https://github.com/rive-app/rive-wasm/blob/6d5cd8909a635184f156be03d1f32d5ceb4025fc/js/src/rive.ts#L1739).Testing locally, this fixes my issue!
Before: The app still crashes if I pass a bad
src
touseRiveFile
.After: If there's a bad
src
, the app does not crash anymore. If thesrc
is valid, the Rive file loads and the animation plays as expected.