use thiserror::Error;
pub type Result<T> = std::result::Result<T, ParserError>;
#[derive(Debug, Error)]
pub enum ParserError {
#[error("Generic error: {0}")]
Generic(String),
#[error("I/O error: {context}: {source}")]
IO {
context: String,
#[source]
source: std::io::Error,
},
#[error("Parse error: {0}")]
Parse(String),
#[error("Component error: {0}")]
Component(String),
#[error(
"Component <{tag}> supplies its own <template> wrapper under --css=module but is \
missing the `shadowrootadoptedstylesheets` attribute, which is required to wire \
the component's CSS module into its shadow root. Add \
`shadowrootadoptedstylesheets=\"{tag}\"` to the <template> tag, or remove the \
<template> wrapper to let the framework manage it automatically."
)]
MissingAdoptedStylesheets {
tag: String,
},
#[error("CSS error: {0}")]
Css(String),
#[error("HTML error: {0}")]
Html(String),
#[error("Directive error: {0}")]
Directive(String),
#[error("Not found: {0}")]
NotFound(String),
#[error("TypeScript parse error: {0}")]
TsParseError(String),
}