Skip to content

Commit c7f8b7d

Browse files
committed
fix logic conflicts
1 parent f9b49eb commit c7f8b7d

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

src/errors/kinds.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,21 @@ impl ErrorKind {
426426
Self::GreaterThanEqual { .. } => extract_context!(GreaterThanEqual, ctx, ge: String),
427427
Self::LessThan { .. } => extract_context!(LessThan, ctx, lt: String),
428428
Self::LessThanEqual { .. } => extract_context!(LessThanEqual, ctx, le: String),
429-
Self::TooShort { .. } => extract_context!(TooShort, ctx, min_length: usize, input_length: usize),
430-
Self::TooLong { .. } => extract_context!(TooLong, ctx, max_length: usize, input_length: usize),
429+
Self::TooShort { .. } => extract_context!(
430+
TooShort,
431+
ctx,
432+
field_type: String,
433+
min_length: usize,
434+
actual_length: usize
435+
),
436+
Self::TooLong { .. } => extract_context!(
437+
TooLong,
438+
ctx,
439+
field_type: String,
440+
max_length: usize,
441+
actual_length: usize
442+
),
443+
Self::IterationError { .. } => extract_context!(IterationError, ctx, error: String),
431444
Self::StrTooShort { .. } => extract_context!(StrTooShort, ctx, min_length: usize),
432445
Self::StrTooLong { .. } => extract_context!(StrTooLong, ctx, max_length: usize),
433446
Self::StrPatternMismatch { .. } => extract_context!(StrPatternMismatch, ctx, pattern: String),

tests/validators/test_function.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -704,10 +704,10 @@ def f(input_value, **kwargs):
704704
),
705705
(
706706
'iteration_error',
707-
'Error iterating over object',
708-
None,
709-
'Error iterating over object',
710-
'Error iterating over object [kind=iteration_error, context=None]',
707+
'Error iterating over object, error: foobar',
708+
{'error': 'foobar'},
709+
'Error iterating over object, error: foobar',
710+
"Error iterating over object, error: foobar [kind=iteration_error, context={'error': 'foobar'}]",
711711
),
712712
(
713713
'list_type',

0 commit comments

Comments
 (0)