diff --git a/noq-proto/src/connection/paths.rs b/noq-proto/src/connection/paths.rs index bc52d1ac1..d4d9b04e7 100644 --- a/noq-proto/src/connection/paths.rs +++ b/noq-proto/src/connection/paths.rs @@ -1041,6 +1041,7 @@ pub enum PathStatus { /// Application events about paths #[derive(Debug, Clone, PartialEq, Eq)] +#[non_exhaustive] pub enum PathEvent { /// A new path has established connection with the peer. Established { diff --git a/noq/src/connection.rs b/noq/src/connection.rs index ee7f88b60..fd9bdee3b 100644 --- a/noq/src/connection.rs +++ b/noq/src/connection.rs @@ -1672,6 +1672,15 @@ impl State { NatTraversal(update) => { self.nat_traversal_updates.send(update).ok(); } + _ => { + // PathEvent is #[non_exhaustive]. + // It's possible that noq is built against a newer noq-proto version. + // In that case, we need to ignore path events we can't handle yet. + // But for tests, we expect noq and noq-proto to be in sync, so we + // should panic in case we don't actually handle new cases. + #[cfg(test)] + panic!("Unhandled PathEvent variant: {event:?}"); + } } } }