From dd8e6bfe168ea214309a08358159932efb6a7d15 Mon Sep 17 00:00:00 2001 From: fufesou Date: Sat, 23 Nov 2024 09:00:18 +0800 Subject: [PATCH] Remove expect Signed-off-by: fufesou --- src/host/screencapturekit/mod.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/host/screencapturekit/mod.rs b/src/host/screencapturekit/mod.rs index 103e63f..cae2280 100644 --- a/src/host/screencapturekit/mod.rs +++ b/src/host/screencapturekit/mod.rs @@ -171,9 +171,17 @@ impl Device { fn default_input_config(&self) -> Result { let config = Self::supported_input_configs(self) - .expect("failed to get supported input configs") + .map_err(|e| DefaultStreamConfigError::BackendSpecific { + err: BackendSpecificError { + description: format!("Failed to get supported input configs: {e}"), + }, + })? .next() - .expect("no supported input configs") + .ok_or(DefaultStreamConfigError::BackendSpecific { + err: BackendSpecificError { + description: "No supported input configs".to_string(), + }, + })? .with_max_sample_rate(); Ok(config) }