bevyengine / bevyengine/bevy

Postcard scene deserialization does not provide readable error for unregistered types.

Open
#7,337 3 comments 0 reactions 0 assignees View on GitHub
A-Scenes C-Bug C-Usability
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

# What you did

I was creating the tests listed in https://github.com/bevyengine/bevy/pull/7336.
During the testing, I was missing one of the `.register_type()` calls, which made all 4 of the backends fail to deserialize. The error messages were clear, except the one for postcard, which was less helpful.

# What went wrong

The output for postcard is this:
```
Serde Deserialization Error
thread 'components::postcard_roundtrip_equality' panicked at 'Scene failed to deserialize: Serde Deserialization Error', tests/scenes/components.rs:61:37
stack backtrace:
```

Which is a lot less helpful than the output for ron, bincode, and messagepack:
```
no registration found for type `(i32, alloc::string::String, f32)`
thread 'components::bincode_roundtrip_equality' panicked at 'Scene failed to deserialize: no registration found for type `(i32, alloc::string::String, f32)`', tests/scenes/components.rs:94:37
stack backtrace:
```

I'd expect the output for "failing to deserialize because of a missing type registration" to be the same, regardless of the backend.

# Additional information
To reproduce, comment out one of the `.register_type` calls in `components.rs` from this pull request: https://github.com/bevyengine/bevy/pull/7336. All 4 backends will fail to deserialize, but postcard will have a criptic message.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.