Skip to content

[API] Gracefully handle protobuf translation issues #370

@Ph4ntomas

Description

@Ph4ntomas

In Protobuf, unless explicitly required (which is discouraged), every field are optional.

This cause trouble in Rust because some field are expected to be set, and those fields type might not have meaningful defaults.
As a result, the current implementation either unwrap or expect said fields, which could cause a server-side panic() to be triggered.

I propose to add a TryFromApi trait, so we can safely abort the RPC in case of conversion error, and log the issue so the users can fix their config.

We'll then need to rewrite any fallible FromApi to make use of this trait instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions