diff options
Diffstat (limited to 'iced_builder/src/error.rs')
| -rw-r--r-- | iced_builder/src/error.rs | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/iced_builder/src/error.rs b/iced_builder/src/error.rs index 8876016..9cbb6ee 100644 --- a/iced_builder/src/error.rs +++ b/iced_builder/src/error.rs @@ -7,12 +7,17 @@ use thiserror::Error; #[error(transparent)] pub enum Error { IOError(Arc<io::Error>), - SerdeError(Arc<serde_json::Error>), + #[error("config does not exist")] + ConfigMissing, + #[error("JSON parsing error: {0}")] + SerdeJSONError(Arc<serde_json::Error>), + #[error("TOML parsing error: {0}")] + SerdeTOMLError(#[from] toml::de::Error), FormatError(Arc<rust_format::Error>), - #[error("The element tree contains no matching element")] + #[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}")] @@ -27,7 +32,7 @@ impl From<io::Error> for Error { impl From<serde_json::Error> for Error { fn from(value: serde_json::Error) -> Self { - Self::SerdeError(Arc::new(value)) + Self::SerdeJSONError(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) + } +} |
