From e9d0dba3c5e46947f70c92a1bc2522647bf5978a Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 12 Nov 2026 09:02:19 +0000 Subject: [PATCH] Return an error when the source socket can't be created Socket::new was unwrapped, so SacnSource construction panicked instead of returning the Io error its docs promise, for example when IPv6 is unavailable or the process is out of file descriptors. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01KzaQVPkrkczgX2g7wGkip5 --- src/source.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/source.rs b/src/source.rs index f701751..205af57 100644 --- a/src/source.rs +++ b/src/source.rs @@ -564,9 +564,9 @@ impl SacnSourceInternal { /// `UnsupportedIpVersion`: Returned if the `SockAddr` is not IPv4 or IPv6. fn with_cid_ip(name: &str, cid: Uuid, ip: SocketAddr) -> Result { let socket = if ip.is_ipv4() { - Socket::new(Domain::IPV4, Type::DGRAM, None).unwrap() + Socket::new(Domain::IPV4, Type::DGRAM, None)? } else if ip.is_ipv6() { - Socket::new(Domain::IPV6, Type::DGRAM, None).unwrap() + Socket::new(Domain::IPV6, Type::DGRAM, None)? } else { return Err(SacnError::UnsupportedIpVersion( "Address to create SacnSource is not IPv4 or IPv6".to_string(),