summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstuebinm2021-04-14 12:33:11 +0200
committerstuebinm2021-04-14 12:33:11 +0200
commitc7f7821b9180854f7f5509f5117a862b285eb7fb (patch)
treed1d40f1428922972ab2832d9b468252f3a4f257b
parentc307b914eca192f8e8648345e365f9c0207bc18c (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.
-rw-r--r--dhall_proc_macros/src/derive.rs8
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",
))
}
};