Files
zed/crates/theme/Cargo.toml
Marshall Bowers 8e7cad7848 theme: Return structured errors when a theme is not found (#25090)
This PR updates the `ThemeRegistry` to return structured errors from the
`get` and `get_icon_theme` methods (which are used to retrieve themes
and icon themes, respectively).

We want to be able to carry the name of the theme that was not found as
state on the error, which is why we use a `Result` and not an `Option`.
However, we also want to be able to accurately identify when the error
case is "not found" so we can take appropriate action, based on the
circumstances.

By using a custom error type instead of an `anyhow::Error`, we get both.

There isn't any functional change in this PR. This just sets us up for
future improvements in this error.

Release Notes:

- N/A
2025-02-18 10:49:55 -05:00

47 lines
1.1 KiB
TOML

[package]
name = "theme"
version = "0.1.0"
edition.workspace = true
publish.workspace = true
license = "GPL-3.0-or-later"
[lints]
workspace = true
[features]
default = []
test-support = ["gpui/test-support", "fs/test-support", "settings/test-support"]
[lib]
path = "src/theme.rs"
doctest = false
[dependencies]
anyhow.workspace = true
collections.workspace = true
derive_more.workspace = true
fs.workspace = true
futures.workspace = true
gpui.workspace = true
indexmap.workspace = true
log.workspace = true
palette = { workspace = true, default-features = false, features = ["std"] }
parking_lot.workspace = true
refineable.workspace = true
schemars = { workspace = true, features = ["indexmap2"] }
serde.workspace = true
serde_derive.workspace = true
serde_json.workspace = true
serde_json_lenient.workspace = true
serde_repr.workspace = true
settings.workspace = true
strum.workspace = true
thiserror.workspace = true
util.workspace = true
uuid.workspace = true
[dev-dependencies]
fs = { workspace = true, features = ["test-support"] }
gpui = { workspace = true, features = ["test-support"] }
settings = { workspace = true, features = ["test-support"] }