Kriskras99 commented on code in PR #512:
URL: https://github.com/apache/avro-rs/pull/512#discussion_r2972093864


##########
avro/src/error.rs:
##########
@@ -553,32 +555,51 @@ pub enum Details {
     #[error("Decoded integer out of range for i32: {1}: {0}")]
     ZagI32(#[source] std::num::TryFromIntError, i64),
 
-    #[error("unable to read block")]
+    #[error("Did not read any bytes, block is corrupt")]
     ReadBlock,
 
     #[error("Failed to serialize value into Avro value: {0}")]
     SerializeValue(String),
 
-    #[error("Failed to serialize value of type {value_type} using schema 
{schema:?}: {value}")]
+    #[error("Failed to serialize value of type `{value_type}` using 
Schema::{schema:?}: {value}")]
     SerializeValueWithSchema {
         value_type: &'static str,
         value: String,
         schema: Schema,
     },
 
-    #[error("Failed to serialize field '{field_name}' for record 
{record_schema:?}: {error}")]
+    #[error("{position} is not a valid index for fields in {schema:?}")]
+    SerializeRecordUnknownFieldIndex {
+        position: usize,
+        schema: RecordSchema,
+    },
+
+    #[error("Failed to serialize field '{field_name}' of record 
{record_schema:?}: {error}")]
     SerializeRecordFieldWithSchema {
         field_name: String,
-        record_schema: Schema,
-        error: Box<Error>,
+        record_schema: RecordSchema,
+        error: String,

Review Comment:
   So I can create a more optimal error string. When an error happens in the 
following chain: record -> field -> record -> field. The schema will be printed 
4 times. This makes the error message almost useless. My modified error (as 
created in `RecordSerializer::field_error`) will only print the top schema and 
then just print the actual errors.



-- 
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