1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
use Error;
/// Helper function to check if a length exceeds a maximum limit.
///
/// This centralizes the common pattern of checking collection lengths against MAX limits.
/// Returns `Some(error)` if the limit is exceeded, `None` otherwise.
///
/// This is an internal helper function and not part of the public API.
pub
/// Helper function to convert `Error::Validation` to a specific `Error` variant.
///
/// This centralizes the common pattern of converting validation errors to specific error variants
/// with a fallback for non-validation errors.
///
/// # Arguments
///
/// * `err` - The `Error` to convert
/// * `variant` - A closure that maps a validation message to the appropriate `Error` variant
/// * `fallback` - A closure that generates a fallback `Error` for non-validation errors
///
/// # Example
///
/// This is an internal helper function used throughout the codebase to convert
/// `Error::Validation` variants to specific error variants with proper
/// error message handling. It's not part of the public API.
pub
/// Helper function to convert `Error::Validation` to a specific `Error` variant,
/// preserving line number information.
///
/// Similar to `map_val_error` but also preserves the line number from the original error
/// in the converted error.
pub