larust_view/error.rs
1/// A template parsing/resolution error. Deliberately just a message -
2/// `larust-macros` is the one place that can turn this into a proper
3/// spanned `syn::Error`, and the file/template context is usually already
4/// in the message by the time it gets there.
5#[derive(Debug)]
6pub struct ParseError(String);
7
8impl ParseError {
9 pub fn new(message: impl Into<String>) -> Self {
10 Self(message.into())
11 }
12}
13
14impl std::fmt::Display for ParseError {
15 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
16 write!(f, "{}", self.0)
17 }
18}
19
20impl std::error::Error for ParseError {}