diff options
| author | Sakarias Johansson <sakarias.johansson@goodbyekansas.com> | 2023-01-05 17:22:10 +0100 |
|---|---|---|
| committer | Sakarias Johansson <sakarias.johansson@goodbyekansas.com> | 2023-01-05 17:22:10 +0100 |
| commit | cf7bd1aec7e9908f80bfc014fc53a1144e17ccb5 (patch) | |
| tree | d37492001d250f7dc7a1584415181ad443f62d8a /racer-tracer/src/error.rs | |
| download | racer-tracer-cf7bd1aec7e9908f80bfc014fc53a1144e17ccb5.tar.gz racer-tracer-cf7bd1aec7e9908f80bfc014fc53a1144e17ccb5.tar.xz racer-tracer-cf7bd1aec7e9908f80bfc014fc53a1144e17ccb5.zip | |
Initial commit 🎉
Diffstat (limited to 'racer-tracer/src/error.rs')
| -rw-r--r-- | racer-tracer/src/error.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/racer-tracer/src/error.rs b/racer-tracer/src/error.rs new file mode 100644 index 0000000..f581b08 --- /dev/null +++ b/racer-tracer/src/error.rs @@ -0,0 +1,26 @@ +use thiserror::Error; + +#[derive(Error, Debug)] +pub enum TracerError { + #[error("Unknown error: {message}")] + Unknown { message: String, exit_code: i32 }, + + #[error("Failed to create window: {0}")] + FailedToCreateWindow(String), + + #[error("Failed to update window: {0}")] + FailedToUpdateWindow(String), +} + +impl From<TracerError> for i32 { + fn from(tracer_error: TracerError) -> Self { + match tracer_error { + TracerError::Unknown { + message: _, + exit_code, + } => exit_code, + TracerError::FailedToCreateWindow(_) => 2, + TracerError::FailedToUpdateWindow(_) => 3, + } + } +} |
