# theme: Return structured errors when a theme is not found \(\#25090\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/8e7cad78488da6a436cc80b9822fdcaf9c177542)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 8e7cad78488da6a436cc80b9822fdcaf9c177542

Requested commit: 8e7cad78488da6a436cc80b9822fdcaf9c177542

Commit: 8e7cad78488da6a436cc80b9822fdcaf9c177542

Tree: cd6c8e9d1147f9cdc8173c779a30959220d167e1

Author: Marshall Bowers

Committer: GitHub

## Message

```
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
```

## Parents

- [76f501af713d51a329b54a389c54ebf39bfc4bf9](https://git.cafe/gitcafe/zed/commit/76f501af713d51a329b54a389c54ebf39bfc4bf9?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/8e7cad78488da6a436cc80b9822fdcaf9c177542?format=markdown)
