summaryrefslogtreecommitdiffstats
path: root/src/error.rs
diff options
context:
space:
mode:
authorToby Vincent <tobyv13@gmail.com>2022-11-17 23:12:10 -0600
committerToby Vincent <tobyv13@gmail.com>2022-11-17 23:12:10 -0600
commit09be0362d42034e343b64de08618c995b63c90fe (patch)
tree23f44d4e36cd767ea86f524db6016d64819eaf9b /src/error.rs
parent082d11db68efa63f6da1be29cc9dc95b8f9e1735 (diff)
feat: get intitial finder working
Diffstat (limited to 'src/error.rs')
-rw-r--r--src/error.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/error.rs b/src/error.rs
index 9e20809..509dba2 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -1,6 +1,9 @@
+use std::process::{ExitCode, Termination};
+
pub type Result<T> = std::result::Result<T, Error>;
#[derive(thiserror::Error, Debug)]
+#[repr(u8)]
pub enum Error {
#[error("IO error: {0}")]
IO(#[from] std::io::Error),
@@ -14,3 +17,10 @@ pub enum Error {
#[error("Finder error: {0}")]
Finder(#[from] crate::finder::Error),
}
+
+impl Termination for Error {
+ fn report(self) -> ExitCode {
+ eprintln!("{}", self);
+ ExitCode::FAILURE
+ }
+}