fix: Improve the error message for unresolved union variant

Fixes #225

Add the UnionSchema and the actual Value to the error message for easier
debugging

Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
diff --git a/avro/src/error.rs b/avro/src/error.rs
index e68495c..e28fa9d 100644
--- a/avro/src/error.rs
+++ b/avro/src/error.rs
@@ -16,7 +16,7 @@
 // under the License.
 
 use crate::{
-    schema::{Name, Schema, SchemaKind},
+    schema::{Name, Schema, SchemaKind, UnionSchema},
     types::{Value, ValueKind},
 };
 use std::{error::Error as _, fmt};
@@ -223,8 +223,8 @@
     #[error("Key {0} not found in decimal metadata JSON")]
     GetDecimalMetadataFromJson(&'static str),
 
-    #[error("Could not find matching type in union")]
-    FindUnionVariant,
+    #[error("Could not find matching type in {schema:?} for {value:?}")]
+    FindUnionVariant { schema: UnionSchema, value: Value },
 
     #[error("Union type should not be empty")]
     EmptyUnion,
diff --git a/avro/src/types.rs b/avro/src/types.rs
index f241661..2c5bdb0 100644
--- a/avro/src/types.rs
+++ b/avro/src/types.rs
@@ -1045,7 +1045,10 @@
         };
         let (i, inner) = schema
             .find_schema_with_known_schemata(&v, Some(names), enclosing_namespace)
-            .ok_or(Error::FindUnionVariant)?;
+            .ok_or(Error::FindUnionVariant {
+                schema: schema.clone(),
+                value: v.clone(),
+            })?;
 
         Ok(Value::Union(
             i as u32,