Skip to content

Commit

Permalink
Remove thiserror dependency
Browse files Browse the repository at this point in the history
Uses derive_more instead
  • Loading branch information
ogoffart committed Jan 6, 2025
1 parent 5824267 commit a942ed0
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 19 deletions.
2 changes: 1 addition & 1 deletion api/rs/build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ i-slint-compiler = { workspace = true, features = ["default", "rust", "display-d
i-slint-core-macros = { workspace = true }

spin_on = { workspace = true }
thiserror = "1"
toml_edit = { workspace = true }
derive_more = { workspace = true, features = ["std", "error"] }
10 changes: 5 additions & 5 deletions api/rs/build/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,17 +192,17 @@ impl CompilerConfiguration {
}

/// Error returned by the `compile` function
#[derive(thiserror::Error, Debug)]
#[derive(derive_more::Error, derive_more::Display, Debug)]
#[non_exhaustive]
pub enum CompileError {
/// Cannot read environment variable CARGO_MANIFEST_DIR or OUT_DIR. The build script need to be run via cargo.
#[error("Cannot read environment variable CARGO_MANIFEST_DIR or OUT_DIR. The build script need to be run via cargo.")]
#[display("Cannot read environment variable CARGO_MANIFEST_DIR or OUT_DIR. The build script need to be run via cargo.")]
NotRunViaCargo,
/// Parse error. The error are printed in the stderr, and also are in the vector
#[error("{0:?}")]
CompileError(Vec<String>),
#[display("{_0:?}")]
CompileError(#[error(not(source))] Vec<String>),
/// Cannot write the generated file
#[error("Cannot write the generated file: {0}")]
#[display("Cannot write the generated file: {_0}")]
SaveError(std::io::Error),
}

Expand Down
1 change: 0 additions & 1 deletion internal/compiler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ quote = { version = "1.0", optional = true }
proc-macro2 = { version = "1.0.17", optional = true }
lyon_path = { version = "1.0" }
lyon_extra = "1.0.1"
thiserror = "1"
by_address = { workspace = true }
itertools = { workspace = true }
once_cell = "1"
Expand Down
3 changes: 1 addition & 2 deletions internal/interpreter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,10 @@ i-slint-backend-selector = { workspace = true, features = ["rtti"] }

vtable = { workspace = true }

derive_more = { workspace = true }
derive_more = { workspace = true, features = ["std", "error"] }
generativity = "1"
lyon_path = { version = "1.0" }
once_cell = "1.5"
thiserror = "1"
document-features = { version = "0.2.0", optional = true }
spin_on = { workspace = true, optional = true }
raw-window-handle-06 = { workspace = true, optional = true }
Expand Down
20 changes: 10 additions & 10 deletions internal/interpreter/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1580,48 +1580,48 @@ impl From<ComponentInstance>
}

/// Error returned by [`ComponentInstance::get_property`]
#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, derive_more::Error, derive_more::Display)]
#[non_exhaustive]
pub enum GetPropertyError {
/// There is no property with the given name
#[error("no such property")]
#[display("no such property")]
NoSuchProperty,
}

/// Error returned by [`ComponentInstance::set_property`]
#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, derive_more::Error, derive_more::Display)]
#[non_exhaustive]
pub enum SetPropertyError {
/// There is no property with the given name.
#[error("no such property")]
#[display("no such property")]
NoSuchProperty,
/// The property exists but does not have a type matching the dynamic value.
///
/// This happens for example when assigning a source struct value to a target
/// struct property, where the source doesn't have all the fields the target struct
/// requires.
#[error("wrong type")]
#[display("wrong type")]
WrongType,
/// Attempt to set an output property.
#[error("access denied")]
#[display("access denied")]
AccessDenied,
}

/// Error returned by [`ComponentInstance::set_callback`]
#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, derive_more::Error, derive_more::Display)]
#[non_exhaustive]
pub enum SetCallbackError {
/// There is no callback with the given name
#[error("no such callback")]
#[display("no such callback")]
NoSuchCallback,
}

/// Error returned by [`ComponentInstance::invoke`]
#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, derive_more::Error, derive_more::Display)]
#[non_exhaustive]
pub enum InvokeError {
/// There is no callback or function with the given name
#[error("no such callback or function")]
#[display("no such callback or function")]
NoSuchCallable,
}

Expand Down

0 comments on commit a942ed0

Please sign in to comment.