summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2024-10-24 11:04:39 -0500
committerJohn Estabrook <jestabro@vyos.io>2024-10-24 11:04:39 -0500
commit45c65c695d6df0cb9cd46ef12245b59514b53549 (patch)
treec9396df2ece6fe48d848af255e5780b31ab9206c /src
parent9ff89e508f81ce71c9073f096fd27c73d4259987 (diff)
downloadvyos1x-config-45c65c695d6df0cb9cd46ef12245b59514b53549.tar.gz
vyos1x-config-45c65c695d6df0cb9cd46ef12245b59514b53549.zip
T6718: catch bad_validator error
Diffstat (limited to 'src')
-rw-r--r--src/value_checker.ml8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/value_checker.ml b/src/value_checker.ml
index 06e3dc7..d94f99d 100644
--- a/src/value_checker.ml
+++ b/src/value_checker.ml
@@ -47,7 +47,9 @@ let validate_any validators constraints value =
match constraints with
| [] -> true
| _ ->
- List.exists (fun c -> validate_value validators buf c value) constraints
+ try
+ List.exists (fun c -> validate_value validators buf c value) constraints
+ with Bad_validator e -> let () = Buffer.add_string buf e in false
in
match validate_exists validators constraints value with
| true ->
@@ -66,7 +68,9 @@ let validate_all validators constraints value =
match constraints with
| [] -> true
| _ ->
- List.for_all (fun c -> validate_value validators buf c value) constraints
+ try
+ List.for_all (fun c -> validate_value validators buf c value) constraints
+ with Bad_validator e -> let () = Buffer.add_string buf e in false
in
match validate_forall validators constraints value with
| true ->