Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better error messages when deserializing a scene #6760

Closed
hymm opened this issue Nov 25, 2022 · 1 comment · Fixed by #8065
Closed

better error messages when deserializing a scene #6760

hymm opened this issue Nov 25, 2022 · 1 comment · Fixed by #8065
Labels
A-Assets Load files from disk to use for things like images, models, and sounds A-Scenes Serialized ECS data stored on the disk C-Usability A targeted quality-of-life change that makes Bevy easier to use

Comments

@hymm
Copy link
Contributor

hymm commented Nov 25, 2022

What problem does this solve or what need does it fill?

I was trying to migrate my scene from an old project to the new format in 0.9 and was getting errors about my format. Below are some examples:

2022-11-25T23:09:37.578114Z  WARN bevy_asset::asset_server: encountered an error while loading an asset: Expected float
2022-11-25T23:10:12.227881Z  WARN bevy_asset::asset_server: encountered an error while loading an asset: unknown field `flags`, expected one of `is_visible_in_hierarchy`, `is_visible_in_view`

The error messages don't give much context to what line or what structure it failed at deserializing. It would be very helpful to have this information to know where in my ron file I need to fix things.

@hymm hymm added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Nov 25, 2022
@alice-i-cecile alice-i-cecile added C-Usability A targeted quality-of-life change that makes Bevy easier to use A-Assets Load files from disk to use for things like images, models, and sounds A-Scenes Serialized ECS data stored on the disk and removed C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Nov 25, 2022
@hymm
Copy link
Contributor Author

hymm commented Mar 10, 2023

looks like ron should give line numbers ron-rs/ron#354. Not sure why they aren't being outputted.

james7132 pushed a commit that referenced this issue Mar 20, 2023
# Objective

- Fixes #6760
- adds line and position on line info to scene errors

```text
Before:
2023-03-12T22:38:59.103220Z  WARN bevy_asset::asset_server: encountered an error while loading an asset: Expected closing `)`
After:
2023-03-12T22:38:59.103220Z  WARN bevy_asset::asset_server: encountered an error while loading an asset: Expected closing `)` at scenes/test/scene.scn.ron:10:4
```

## Solution

- use span_error to get position info. This is what the ron crate does
internally to get the position info.
https://github.com/ron-rs/ron/blob/562963f88733cae0e3ca2a128b590817f0346343/src/options.rs#L158

## Changelog

- added line numbers to scene errors

---------

Co-authored-by: Paul Hansen <[email protected]>
mockersf pushed a commit that referenced this issue Mar 27, 2023
# Objective

- Fixes #6760
- adds line and position on line info to scene errors

```text
Before:
2023-03-12T22:38:59.103220Z  WARN bevy_asset::asset_server: encountered an error while loading an asset: Expected closing `)`
After:
2023-03-12T22:38:59.103220Z  WARN bevy_asset::asset_server: encountered an error while loading an asset: Expected closing `)` at scenes/test/scene.scn.ron:10:4
```

## Solution

- use span_error to get position info. This is what the ron crate does
internally to get the position info.
https://github.com/ron-rs/ron/blob/562963f88733cae0e3ca2a128b590817f0346343/src/options.rs#L158

## Changelog

- added line numbers to scene errors

---------

Co-authored-by: Paul Hansen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Assets Load files from disk to use for things like images, models, and sounds A-Scenes Serialized ECS data stored on the disk C-Usability A targeted quality-of-life change that makes Bevy easier to use
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants