report which field a struct validation error occured in

This commit is contained in:
Pat Hickey
2020-01-29 13:18:57 -08:00
parent 814dd19488
commit e2079c085d
2 changed files with 39 additions and 2 deletions

View File

@@ -11,4 +11,11 @@ pub enum GuestError {
PtrNotAligned(Region, u32),
#[error("Pointer already borrowed: {0:?}")]
PtrBorrowed(Region),
#[error("In {typename}.{field}:")]
InField {
typename: String,
field: String,
#[source]
err: Box<GuestError>,
},
}