Implement Error for error types (#1)
This commit is contained in:
parent
a153d2dcce
commit
bbf6009c0c
3 changed files with 7 additions and 9 deletions
|
@ -15,3 +15,4 @@ gstreamer = "0.16.2"
|
|||
gstreamer-app = "0.16.0"
|
||||
gstreamer-video = "0.16.0"
|
||||
log = "0.4"
|
||||
thiserror = "1"
|
||||
|
|
11
src/file.rs
11
src/file.rs
|
@ -38,13 +38,8 @@ impl IntoIterator for FileSource {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum CaptureError {
|
||||
IoError(io::Error),
|
||||
}
|
||||
|
||||
impl From<io::Error> for CaptureError {
|
||||
fn from(err: io::Error) -> Self {
|
||||
CaptureError::IoError(err)
|
||||
}
|
||||
#[error("IO error: {0}")]
|
||||
IoError(#[from] io::Error),
|
||||
}
|
||||
|
|
|
@ -33,9 +33,11 @@ pub struct GstErrorMessage {
|
|||
pub source: glib::Error,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum StreamError {
|
||||
#[error("GST error: {0:?}")]
|
||||
GstError(GstErrorMessage),
|
||||
#[error("frame capture error")]
|
||||
FrameCaptureError,
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue