From abe16ae53b0c6bd1eb9127b8e39c60557ce7c2f9 Mon Sep 17 00:00:00 2001 From: chaos Date: Wed, 8 Nov 2023 15:25:13 +0000 Subject: [PATCH] don't use a string error on ffprobe handler, pass the proper error --- modules/ffprobe/src/errors.rs | 2 ++ src/utils/formats/handlers/ffprobe.rs | 4 +--- src/utils/mod.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/ffprobe/src/errors.rs b/modules/ffprobe/src/errors.rs index c4f08b6..f1ee6c3 100644 --- a/modules/ffprobe/src/errors.rs +++ b/modules/ffprobe/src/errors.rs @@ -7,6 +7,8 @@ pub enum AnalyzeError { ParseError(serde_json::Error), } +impl std::error::Error for AnalyzeError {} + impl fmt::Display for AnalyzeError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { diff --git a/src/utils/formats/handlers/ffprobe.rs b/src/utils/formats/handlers/ffprobe.rs index 0423698..e229190 100644 --- a/src/utils/formats/handlers/ffprobe.rs +++ b/src/utils/formats/handlers/ffprobe.rs @@ -3,8 +3,6 @@ use std::{ process::Command, }; -use string_error::into_err; - use crate::{ meta, types::{AudioFileInfo, Tags}, @@ -41,7 +39,7 @@ impl GenericFFMpegAudioFormat { let output = ffprobe::analyze(&self.path, Some(meta::FFPROBE)); if let Err(err) = output { - return Err(into_err(format!("{}", err))); + return Err(Box::from(err)); } let output = output.unwrap(); diff --git a/src/utils/mod.rs b/src/utils/mod.rs index ad5b98e..ab3cba4 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -5,4 +5,4 @@ pub mod formats; mod music_scanner; pub use formats::is_supported_file; -pub use music_scanner::scan_for_music; +pub use music_scanner::scan_for_music; \ No newline at end of file