From 0dad6dd5b8395d3089bed022a4b8830f7cae7d9f Mon Sep 17 00:00:00 2001 From: pml68 Date: Mon, 30 Dec 2024 02:15:10 +0100 Subject: feat: add config loading, with theming support, limited to Palette for now --- iced_builder/src/error.rs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'iced_builder/src/error.rs') 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), - SerdeError(Arc), + #[error("config does not exist")] + ConfigMissing, + #[error("JSON parsing error: {0}")] + SerdeJSONError(Arc), + #[error("TOML parsing error: {0}")] + SerdeTOMLError(#[from] toml::de::Error), FormatError(Arc), - #[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 for Error { impl From 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 for Error { + fn from(value: String) -> Self { + Self::Other(value) + } +} -- cgit v1.2.3