1use miette::Diagnostic;
4use thiserror::Error;
5
6#[derive(Debug, Error, Diagnostic)]
8#[non_exhaustive]
9pub enum AssetError {
10 #[error("asset not found: {0}")]
12 #[diagnostic(code(rtb::assets::not_found))]
13 NotFound(String),
14
15 #[error("asset `{path}` is not valid UTF-8")]
18 #[diagnostic(code(rtb::assets::not_utf8))]
19 NotUtf8 {
20 path: String,
22 },
23
24 #[error("failed to parse asset `{path}` as {format}: {message}")]
26 #[diagnostic(code(rtb::assets::parse), help("verify the file is well-formed {format}"))]
27 Parse {
28 path: String,
30 format: &'static str,
32 message: String,
34 },
35}