johanhelsing / bevy_web_asset

Bevy asset loader that transparently supports loading over http(s)
Apache License 2.0
71 stars 17 forks source link

ocasional panic #4

Closed gilescope closed 1 year ago

gilescope commented 1 year ago

The unwrap here is causing a panic occasionally: https://github.com/johanhelsing/bevy_web_asset/blob/d4cd4f42f255c39db9f79434c283259e2313d74f/src/web_asset_io.rs#L26

panicked at 'called `Result::unwrap()` on an `Err` value: JsValue(TypeError: NetworkError when attempting to fetch resource.
)', /home/gilescope/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_web_asset-0.4.0/src/web_asset_io.rs:26:83
johanhelsing commented 1 year ago

Thanks. I guess warning and retrying after a small timeout is probably the best thing to do in most cases?

We could do that as first measure, then add special casing for various http 4xx and 5xx codes later.

gilescope commented 1 year ago

Sounds perfect! I guess it depends on the status code as to if it’s sensible to retry.

On Tue, 20 Sep 2022 at 08:01, Johan Klokkhammer Helsing < @.***> wrote:

Thanks. I guess warning and retrying after a small timeout is probably the best thing to do in most cases?

We could do that as first measure, then add special casing for various http 4xx and 5xx codes later.

— Reply to this email directly, view it on GitHub https://github.com/johanhelsing/bevy_web_asset/issues/4#issuecomment-1251924974, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGEJCA6JC3W43TNSEH232TV7FONJANCNFSM6AAAAAAQQXRU6U . You are receiving this because you authored the thread.Message ID: @.***>

johanhelsing commented 1 year ago

I fixed the panic at least. Don't have time to look into retrying now, but created new issues for that.