martin-g commented on code in PR #2600:
URL: https://github.com/apache/avro/pull/2600#discussion_r1412052751


##########
lang/rust/avro/src/error.rs:
##########
@@ -480,45 +480,44 @@ pub enum Error {
     BadCodecMetadata,
 }
 
-#[derive(thiserror::Error, Debug)]
+#[derive(thiserror::Error, PartialEq)]
 pub enum CompatibilityError {
-    #[error("Schemas are not compatible. Writer schema is 
{writer_schema_type}, but reader schema is {reader_schema_type}")]
+    #[error("Incompatible schema types! Writer schema is 
'{writer_schema_type}', but reader schema is '{reader_schema_type}'")]
     WrongType {
         writer_schema_type: String,
         reader_schema_type: String,
     },
 
-    #[error("Schemas are not compatible. The {schema_type} should have been 
{expected_type}")]
+    #[error("Incompatible schema types! The {schema_type} should have been 
{expected_type:?}")]
     TypeExpected {
         schema_type: String,
-        expected_type: String,
+        expected_type: &'static [SchemaKind],
     },
 
-    #[error("Schemas are not compatible. Field '{0}' in reader schema does not 
match the type in the writer schema")]
-    FieldTypeMismatch(String),
+    #[error("Incompatible schemata! Field '{0}' in reader schema does not 
match the type in the writer schema")]
+    FieldTypeMismatch(String, #[source] Box<CompatibilityError>),
 
-    #[error("Schemas are not compatible. Schemas mismatch")]
-    SchemaMismatch,
-
-    #[error("Schemas are not compatible. Field '{0}' in reader schema must 
have a default value")]
+    #[error("Incompatible schemata! Field '{0}' in reader schema must have a 
default value")]
     MissingDefaultValue(String),
 
-    #[error("Schemas are not compatible. Reader's symbols must contain all 
writer's symbols")]
+    #[error("Incompatible schemata! Reader's symbols must contain all writer's 
symbols")]

Review Comment:
   It is the used word in the Rust SDK. Consistency is a good thing!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to