Improve misplaced block error message.
This commit is contained in:
parent
e80c8e6d88
commit
1823e5ecb9
|
@ -25,7 +25,13 @@ impl Node {
|
|||
let text = TokenTree::Literal(text);
|
||||
Ok(quote!(Box::new(typed_html::dom::TextNode::new(#text.to_string()))))
|
||||
}
|
||||
Node::Block(_) => panic!("cannot have a block in this position"),
|
||||
Node::Block(group) => {
|
||||
let span = group.span();
|
||||
let error = "you cannot use a block as a top level element or a required child element";
|
||||
Err(quote_spanned!{ span=>
|
||||
compile_error! { #error }
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue