summaryrefslogtreecommitdiff
path: root/iced_builder/src/error.rs
diff options
context:
space:
mode:
authorpml68 <contact@pml68.dev>2024-12-30 02:15:10 +0100
committerpml68 <contact@pml68.dev>2024-12-30 02:15:10 +0100
commit0dad6dd5b8395d3089bed022a4b8830f7cae7d9f (patch)
treee28ccc225c07f9b49a1c233fb81c8eddd75a01c0 /iced_builder/src/error.rs
parentrefactor!: switch to `uuid` for uuid generation (diff)
downloadiced-builder-0dad6dd5b8395d3089bed022a4b8830f7cae7d9f.tar.gz
feat: add config loading, with theming support, limited to Palette for now
Diffstat (limited to '')
-rw-r--r--iced_builder/src/error.rs19
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)
+ }
+}