From e29c274aaf14c68761bf68e6a054985eba567fa5 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Mon, 3 Jun 2024 20:34:01 +0100 Subject: [PATCH] refactor: server: use thiserror --- crates/server/Cargo.toml | 1 + crates/server/src/actors/file_watcher.rs | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/server/Cargo.toml b/crates/server/Cargo.toml index 0b575865..3d21f08b 100644 --- a/crates/server/Cargo.toml +++ b/crates/server/Cargo.toml @@ -41,6 +41,7 @@ warp = { workspace = true } # boilerplate derive_more = { workspace = true } +thiserror = { workspace = true } # file watcher inotify = { workspace = true } diff --git a/crates/server/src/actors/file_watcher.rs b/crates/server/src/actors/file_watcher.rs index 52875b95..7663147b 100644 --- a/crates/server/src/actors/file_watcher.rs +++ b/crates/server/src/actors/file_watcher.rs @@ -15,11 +15,11 @@ pub struct WatchFile; #[rtype(result = "()")] pub struct FileUpdated; -#[derive(Debug, derive_more::From, derive_more::Display)] +#[derive(Debug, thiserror::Error)] pub enum Error { - Io(std::io::Error), + #[error("io")] + Io(#[from] std::io::Error), } -impl std::error::Error for Error {} pub struct FileWatcher { path: PathBuf,