diff options
| author | Polesznyák Márk László <116908301+pml68@users.noreply.github.com> | 2025-01-11 23:13:07 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-11 23:13:07 +0100 |
| commit | 103699beeb8bdce38bc5803cbe038e74cbc20e40 (patch) | |
| tree | b79e13b3decc778cc7c66af7187c647ae0a21a52 /src/error.rs | |
| parent | Merge pull request #4 from pml68/feat/playground (diff) | |
| parent | refactor: remove iced_drop & workspace (diff) | |
| download | iced-builder-103699beeb8bdce38bc5803cbe038e74cbc20e40.tar.gz | |
Merge pull request #5 from pml68/feat/config
Config done
Diffstat (limited to '')
| -rw-r--r-- | src/error.rs (renamed from iced_builder/src/error.rs) | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/iced_builder/src/error.rs b/src/error.rs index 8876016..f4011bd 100644 --- a/iced_builder/src/error.rs +++ b/src/error.rs @@ -6,13 +6,18 @@ use thiserror::Error; #[derive(Debug, Clone, Error)] #[error(transparent)] pub enum Error { - IOError(Arc<io::Error>), - SerdeError(Arc<serde_json::Error>), - FormatError(Arc<rust_format::Error>), - #[error("The element tree contains no matching element")] + IO(Arc<io::Error>), + #[error("config does not exist")] + ConfigMissing, + #[error("JSON parsing error: {0}")] + SerdeJSON(Arc<serde_json::Error>), + #[error("TOML parsing error: {0}")] + SerdeTOML(#[from] toml::de::Error), + RustFmt(Arc<rust_format::Error>), + #[error("the element tree contains no matching element")] NonExistentElement, #[error( - "The file dialog has been closed without selecting a valid option" + "the file dialog has been closed without selecting a valid option" )] DialogClosed, #[error("{0}")] @@ -21,19 +26,19 @@ pub enum Error { impl From<io::Error> for Error { fn from(value: io::Error) -> Self { - Self::IOError(Arc::new(value)) + Self::IO(Arc::new(value)) } } impl From<serde_json::Error> for Error { fn from(value: serde_json::Error) -> Self { - Self::SerdeError(Arc::new(value)) + Self::SerdeJSON(Arc::new(value)) } } impl From<rust_format::Error> for Error { fn from(value: rust_format::Error) -> Self { - Self::FormatError(Arc::new(value)) + Self::RustFmt(Arc::new(value)) } } @@ -42,3 +47,9 @@ impl From<&str> for Error { Self::Other(value.to_owned()) } } + +impl From<String> for Error { + fn from(value: String) -> Self { + Self::Other(value) + } +} |
