From 828c06e872b0d717e181136f4a344b9ccc77947f Mon Sep 17 00:00:00 2001 From: Callum Leslie Date: Tue, 2 Sep 2025 21:56:53 +0100 Subject: [PATCH] fix: implement error for error types Fixes the failing doctests --- Cargo.toml | 1 + src/error.rs | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 70b15f8..5cbcbed 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,5 +14,6 @@ categories = [] exclude = ["flake.nix", "flake.lock", ".envrc", "cliff.toml", "release-plz.toml", "rustfmt.toml", ".github"] [dependencies] +thiserror = "2.0" [lib] diff --git a/src/error.rs b/src/error.rs index 8481cbd..095860e 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,15 +1,21 @@ +use thiserror::Error; + /// Errors that can occur when using the suck channel -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Error, Debug, Clone, PartialEq, Eq)] pub enum Error { /// Channel has been closed gracefully + #[error("Channel closed")] ChannelClosed, /// Producer has disconnected unexpectedly + #[error("Producer disconnected")] ProducerDisconnected, /// No value source has been set + #[error("Producer has not set a source value")] NoSource, /// Internal error (e.g., mutex poisoning or source execution failure) + #[error("Internal error occured")] // TODO: Expand on this InternalError, }