use miette::{Diagnostic, SourceSpan};
use starbase_styles::{Style, Stylize};
use thiserror::Error;
#[derive(Clone, Debug, Diagnostic, Error)]
#[error("{message}")]
pub struct ParseError {
pub message: String,
}
impl ParseError {
pub fn new<T: AsRef<str>>(message: T) -> Self {
ParseError {
message: message.as_ref().to_owned(),
}
}
}
#[derive(Error, Debug, Diagnostic)]
#[error("{}{} {message}", .path.style(Style::Id), ":".style(Style::MutedLight))]
#[diagnostic(severity(Error))]
pub struct ParserError {
#[source_code]
pub content: String, pub message: String,
pub path: String,
#[label("Fix this")]
pub span: Option<SourceSpan>,
}