pub fn invalid_field_err_with_source<T: InvalidFieldErr + WithSource, E: Source>(
context: &'static str,
field: &'static str,
reason: &'static str,
source: E,
) -> T
Expand description
Helper function to create an “invalid field” error with a source.
This function is a convenience wrapper around the InvalidFieldErr
and WithSource
traits.
§Arguments
context
- The context in which the error occurred.field
- The name of the invalid field.reason
- The reason why the field is invalid.source
- The source error to add.
§Returns
A new error instance of type T
that implements both InvalidFieldErr
and WithSource
.