MCPcopy Index your code
hub / github.com/biblius/validify / fmt

Method fmt

validify/src/error.rs:277–304  ·  view source on GitHub ↗
(&self, fmt: &mut std::fmt::Formatter<'_>)

Source from the content-addressed store, hash-verified

275
276impl std::fmt::Display for ValidationError {
277 fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
278 match self {
279 ValidationError::Schema {
280 code,
281 ref message,
282 ref location,
283 } => {
284 let message = message.as_ref().map_or_else(|| "", |f| f);
285 write!(
286 fmt,
287 "Schema validation error: {{ code: {code} message: {message}, location: {location} }}"
288 )
289 }
290 ValidationError::Field {
291 code,
292 message,
293 field,
294 params,
295 location,
296 } => {
297 let message = message.as_ref().map_or_else(|| "", |f| f);
298 write!(
299 fmt,
300 "Validation error: {{ code: {code} location: {location}, field: {}, message: {message}, params: {params:?} }}", field.unwrap()
301 )
302 }
303 }
304 }
305}
306
307impl std::fmt::Display for ValidationErrors {

Callers

nothing calls this directly

Calls 1

errorsMethod · 0.80

Tested by

no test coverage detected