Skip to content

Commit

Permalink
feat: update error message (close #58)
Browse files Browse the repository at this point in the history
  • Loading branch information
g-plane committed Sep 25, 2024
1 parent bf6c7b4 commit f404d6c
Showing 1 changed file with 35 additions and 35 deletions.
70 changes: 35 additions & 35 deletions markup_fmt/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,45 +51,45 @@ pub enum SyntaxErrorKind {
impl fmt::Display for SyntaxError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let reason: Cow<_> = match self.kind {
SyntaxErrorKind::ExpectAngularFor => "expect Angular `@for`".into(),
SyntaxErrorKind::ExpectAngularIf => "expect Angular `@if`".into(),
SyntaxErrorKind::ExpectAngularLet => "expect Angular `@let`".into(),
SyntaxErrorKind::ExpectAngularSwitch => "expect Angular `@switch`".into(),
SyntaxErrorKind::ExpectAstroAttr => "expect Astro attribute".into(),
SyntaxErrorKind::ExpectAstroExpr => "expect Astro expression".into(),
SyntaxErrorKind::ExpectAttrName => "expect attribute name".into(),
SyntaxErrorKind::ExpectAttrValue => "expect attribute value".into(),
SyntaxErrorKind::ExpectChar(c) => format!("expect char '{c}'").into(),
SyntaxErrorKind::ExpectCloseTag => "expect close tag".into(),
SyntaxErrorKind::ExpectComment => "expect comment".into(),
SyntaxErrorKind::ExpectDoctype => "expect HTML doctype".into(),
SyntaxErrorKind::ExpectElement => "expect element".into(),
SyntaxErrorKind::ExpectFrontMatter => "expect front matter".into(),
SyntaxErrorKind::ExpectIdentifier => "expect identifier".into(),
SyntaxErrorKind::ExpectJinjaBlockEnd => "expect Jinja block end".into(),
SyntaxErrorKind::ExpectJinjaTag => "expect Jinja tag".into(),
SyntaxErrorKind::ExpectAngularFor => "expected Angular `@for`".into(),
SyntaxErrorKind::ExpectAngularIf => "expected Angular `@if`".into(),
SyntaxErrorKind::ExpectAngularLet => "expected Angular `@let`".into(),
SyntaxErrorKind::ExpectAngularSwitch => "expected Angular `@switch`".into(),
SyntaxErrorKind::ExpectAstroAttr => "expected Astro attribute".into(),
SyntaxErrorKind::ExpectAstroExpr => "expected Astro expression".into(),
SyntaxErrorKind::ExpectAttrName => "expected attribute name".into(),
SyntaxErrorKind::ExpectAttrValue => "expected attribute value".into(),
SyntaxErrorKind::ExpectChar(c) => format!("expected char '{c}'").into(),
SyntaxErrorKind::ExpectCloseTag => "expected close tag".into(),
SyntaxErrorKind::ExpectComment => "expected comment".into(),
SyntaxErrorKind::ExpectDoctype => "expected HTML doctype".into(),
SyntaxErrorKind::ExpectElement => "expected element".into(),
SyntaxErrorKind::ExpectFrontMatter => "expected front matter".into(),
SyntaxErrorKind::ExpectIdentifier => "expected identifier".into(),
SyntaxErrorKind::ExpectJinjaBlockEnd => "expected Jinja block end".into(),
SyntaxErrorKind::ExpectJinjaTag => "expected Jinja tag".into(),
SyntaxErrorKind::ExpectKeyword(keyword) => {
format!("expect keyword '{}'", keyword).into()
format!("expected keyword '{}'", keyword).into()
}
SyntaxErrorKind::ExpectMustacheInterpolation => {
"expect mustache-like interpolation".into()
"expected mustache-like interpolation".into()
}
SyntaxErrorKind::ExpectSelfCloseTag => "expect self close tag".into(),
SyntaxErrorKind::ExpectSvelteAtTag => "expect Svelte `{@` tag".into(),
SyntaxErrorKind::ExpectSvelteAttr => "expect Svelte attribute".into(),
SyntaxErrorKind::ExpectSvelteAwaitBlock => "expect Svelte await block".into(),
SyntaxErrorKind::ExpectSvelteBlockEnd => "expect end of Svelte block".into(),
SyntaxErrorKind::ExpectSvelteCatchBlock => "expect Svelte catch block".into(),
SyntaxErrorKind::ExpectSvelteEachBlock => "expect Svelte each block".into(),
SyntaxErrorKind::ExpectSvelteElseIfBlock => "expect Svelte else if block".into(),
SyntaxErrorKind::ExpectSvelteIfBlock => "expect Svelte if block".into(),
SyntaxErrorKind::ExpectSvelteInterpolation => "expect Svelte interpolation".into(),
SyntaxErrorKind::ExpectSvelteKeyBlock => "expect Svelte key block".into(),
SyntaxErrorKind::ExpectSvelteThenBlock => "expect Svelte then block".into(),
SyntaxErrorKind::ExpectTagName => "expect tag name".into(),
SyntaxErrorKind::ExpectTextNode => "expect text node".into(),
SyntaxErrorKind::ExpectVentoBlockEnd => "expect Vento block end".into(),
SyntaxErrorKind::ExpectVueDirective => "expect Vue directive".into(),
SyntaxErrorKind::ExpectSelfCloseTag => "expected self close tag".into(),
SyntaxErrorKind::ExpectSvelteAtTag => "expected Svelte `{@` tag".into(),
SyntaxErrorKind::ExpectSvelteAttr => "expected Svelte attribute".into(),
SyntaxErrorKind::ExpectSvelteAwaitBlock => "expected Svelte await block".into(),
SyntaxErrorKind::ExpectSvelteBlockEnd => "expected end of Svelte block".into(),
SyntaxErrorKind::ExpectSvelteCatchBlock => "expected Svelte catch block".into(),
SyntaxErrorKind::ExpectSvelteEachBlock => "expected Svelte each block".into(),
SyntaxErrorKind::ExpectSvelteElseIfBlock => "expected Svelte else if block".into(),
SyntaxErrorKind::ExpectSvelteIfBlock => "expected Svelte if block".into(),
SyntaxErrorKind::ExpectSvelteInterpolation => "expected Svelte interpolation".into(),
SyntaxErrorKind::ExpectSvelteKeyBlock => "expected Svelte key block".into(),
SyntaxErrorKind::ExpectSvelteThenBlock => "expected Svelte then block".into(),
SyntaxErrorKind::ExpectTagName => "expected tag name".into(),
SyntaxErrorKind::ExpectTextNode => "expected text node".into(),
SyntaxErrorKind::ExpectVentoBlockEnd => "expected Vento block end".into(),
SyntaxErrorKind::ExpectVueDirective => "expected Vue directive".into(),
};

write!(
Expand Down

0 comments on commit f404d6c

Please sign in to comment.