jspg error refactoring checkpoint
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
use crate::validator::context::ValidationContext;
|
||||
use crate::validator::error::ValidationError;
|
||||
use crate::validator::result::ValidationResult;
|
||||
use std::collections::HashMap;
|
||||
|
||||
pub mod array;
|
||||
pub mod cases;
|
||||
@ -61,7 +62,9 @@ impl<'a> ValidationContext<'a> {
|
||||
if self.depth > 100 {
|
||||
Err(ValidationError {
|
||||
code: "RECURSION_LIMIT_EXCEEDED".to_string(),
|
||||
message: "Recursion limit exceeded".to_string(),
|
||||
values: Some(HashMap::from([
|
||||
("limit".to_string(), 100.to_string()),
|
||||
])),
|
||||
path: self.path.to_string(),
|
||||
})
|
||||
} else {
|
||||
@ -73,7 +76,7 @@ impl<'a> ValidationContext<'a> {
|
||||
if self.schema.always_fail {
|
||||
result.errors.push(ValidationError {
|
||||
code: "FALSE_SCHEMA".to_string(),
|
||||
message: "Schema is false".to_string(),
|
||||
values: None,
|
||||
path: self.path.to_string(),
|
||||
});
|
||||
// Short-circuit
|
||||
|
||||
Reference in New Issue
Block a user