1use thiserror::Error;
7
8pub type Result<T> = std::result::Result<T, ParserError>;
10
11#[derive(Debug, Error)]
13pub enum ParserError {
14 #[error("Generic error: {0}")]
16 Generic(String),
17
18 #[error("I/O error: {context}: {source}")]
20 IO {
21 context: String,
23 #[source]
25 source: std::io::Error,
26 },
27
28 #[error("Parse error: {0}")]
30 Parse(String),
31
32 #[error("Component error: {0}")]
34 Component(String),
35
36 #[error(
42 "Component <{tag}> supplies its own <template> wrapper under --css=module but is \
43 missing the `shadowrootadoptedstylesheets` attribute, which is required to wire \
44 the component's CSS module into its shadow root. Add \
45 `shadowrootadoptedstylesheets=\"{tag}\"` to the <template> tag, or remove the \
46 <template> wrapper to let the framework manage it automatically."
47 )]
48 MissingAdoptedStylesheets {
49 tag: String,
51 },
52
53 #[error("CSS error: {0}")]
55 Css(String),
56
57 #[error("HTML error: {0}")]
59 Html(String),
60
61 #[error("Directive error: {0}")]
63 Directive(String),
64
65 #[error("Not found: {0}")]
67 NotFound(String),
68
69 #[error("TypeScript parse error: {0}")]
71 TsParseError(String),
72}