diff options
author | stuebinm | 2021-04-14 12:33:11 +0200 |
---|---|---|
committer | stuebinm | 2021-04-14 12:33:11 +0200 |
commit | c7f7821b9180854f7f5509f5117a862b285eb7fb (patch) | |
tree | d1d40f1428922972ab2832d9b468252f3a4f257b /dhall_proc_macros/src | |
parent | c307b914eca192f8e8648345e365f9c0207bc18c (diff) |
derive macro: better error messages
all error messages should now explicitly print that they occured while
deriving a StaticType — before, they would just print out the error by
itself, which could be confusing without context or knowing which
derive-macro caused the error.
Diffstat (limited to 'dhall_proc_macros/src')
-rw-r--r-- | dhall_proc_macros/src/derive.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/dhall_proc_macros/src/derive.rs b/dhall_proc_macros/src/derive.rs index 27d911f..0975d98 100644 --- a/dhall_proc_macros/src/derive.rs +++ b/dhall_proc_macros/src/derive.rs @@ -81,11 +81,11 @@ fn derive_for_enum( } syn::Fields::Unnamed(_) => Err(Error::new( v.span(), - "Variants with more than one field are not supported", + "Derive StaticType: Variants with more than one field are not supported", )), syn::Fields::Named(_) => Err(Error::new( v.span(), - "Named variants are not supported", + "Derive StaticType: Named variants are not supported", )), } }) @@ -111,14 +111,14 @@ pub fn derive_static_type_inner( syn::Data::Enum(data) if data.variants.is_empty() => { return Err(Error::new( input.span(), - "Empty enums are not supported", + "Derive StaticType: Empty enums are not supported", )) } syn::Data::Enum(data) => derive_for_enum(data, &mut constraints)?, syn::Data::Union(x) => { return Err(Error::new( x.union_token.span(), - "Unions are not supported", + "Derive StaticType: Unions are not supported", )) } }; |