1
0

errors.rs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. macro_rules! missing_trailing_comma {
  2. ($span:expr) => {
  3. return Err(syn::Error::new($span, "missing trailing comma"));
  4. };
  5. }
  6. macro_rules! attr_after_element {
  7. ($span:expr) => {
  8. return Err(syn::Error::new($span, "expected element\n = help move the attribute above all the children and text elements"));
  9. };
  10. }
  11. macro_rules! component_path_cannot_have_arguments {
  12. ($span:expr) => {
  13. return Err(Error::new(
  14. $span,
  15. "expected a path without arguments\n = try remove the path arguments",
  16. ));
  17. };
  18. }
  19. macro_rules! invalid_component_path {
  20. ($span:expr) => {
  21. return Err(Error::new($span, "Invalid component path syntax"));
  22. };
  23. }
  24. macro_rules! invalid_key {
  25. ($_key:ident) => {
  26. let val = $_key.to_static().unwrap();
  27. return Err(syn::Error::new(
  28. $_key.span(),
  29. format!("Element keys must be a dynamic value. Considering using `key: {{{val}}}` instead.\nStatic keys will result in every element using the same key which will cause rendering issues or panics."),
  30. ));
  31. };
  32. }