Skip to content

OriginConsumer::announced panics if prefix does not match #910

@roberte777

Description

@roberte777

I wanted to check if this behavior was expected. If it is not expected, I am more than happy to open a PR to solve.

I was hoping to use with_root to filter out broadcasts from other roots. However, if a broadcast is announced and it does not have the root / prefix that I defined, there is an unwrap that gets hit. My expectation is that this announcement would be filtered out instead.

let mut announcements = self
    .consumer
    .with_root(&prefix)
    .ok_or_else(|| RpcError::Moq(format!("prefix '{prefix}' not authorized")))?;

match announcements.announced().await {
// some logic
}
thread 'main' (6564335) panicked at /Users/ethan.wilkes/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/moq-lite-0.12.0/src/model/origin.rs:37:60:
called `Option::unwrap()` on a `None` value

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