Skip to content

Panic without good error message in prost-build when message not in graph #1282

@kriswuollett

Description

@kriswuollett

Just like #932, prost-build panics without a good error message when a message is somehow not in the message graph:

pub fn can_message_derive_copy(&self, fq_message_name: &str) -> bool {
assert_eq!(".", &fq_message_name[..1]);
self.message_graph
.get_message(fq_message_name)
.unwrap()
.field
.iter()
.all(|field| self.can_field_derive_copy(fq_message_name, field))
}

Encountered when trying to compile potentially well-known protos within google/rpc/*.proto:

  thread 'main' panicked at /Users/kris/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/prost-build-0.13.5/src/context.rs:181:14:
  called `Option::unwrap()` on a `None` value

It would be nice rich errors were provided, potentially something simple like anyhow::{Context, Error}, instead of panicing without specifying which message name the build had a problem with.

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