mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-22 20:23:09 +00:00
Use error instead of panic for span location in rsx macro shorthand
This commit is contained in:
parent
aff5259654
commit
8881b8a473
1 changed files with 11 additions and 1 deletions
|
@ -140,7 +140,17 @@ impl Parse for Element {
|
|||
|
||||
// If the shorthand field is children, these are actually children!
|
||||
if name == "children" {
|
||||
panic!("children must be wrapped in braces");
|
||||
return Err(syn::Error::new(
|
||||
name.span(),
|
||||
format!(
|
||||
r#"Shorthand element children are not supported.
|
||||
To pass children into elements, wrap them in curly braces.
|
||||
Like so:
|
||||
div {{ {{children}} }}
|
||||
|
||||
"#,
|
||||
),
|
||||
));
|
||||
};
|
||||
|
||||
let value = ElementAttrValue::Shorthand(name.clone());
|
||||
|
|
Loading…
Reference in a new issue