Skip to content

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

@Wcubed

Description

@Wcubed

What you did

I was creating the tests listed in #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: #7336. All 4 backends will fail to deserialize, but postcard will have a criptic message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ScenesSerialized ECS data stored on the diskC-BugAn unexpected or incorrect behaviorC-UsabilityA targeted quality-of-life change that makes Bevy easier to use

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions