diff options
author | John Estabrook <jestabro@vyos.io> | 2025-04-10 20:28:20 -0500 |
---|---|---|
committer | John Estabrook <jestabro@vyos.io> | 2025-04-11 13:32:31 -0500 |
commit | f6653abbc5d4a5229fafa49d49bf517f6baada33 (patch) | |
tree | 29f42006c605a639ec0a1bcc467225ec880c7e5f /src/session.ml | |
parent | 377b90c7f529d0fb2207436c7af5de71a87b7090 (diff) | |
download | vyconf-f6653abbc5d4a5229fafa49d49bf517f6baada33.tar.gz vyconf-f6653abbc5d4a5229fafa49d49bf517f6baada33.zip |
T7321: catch Useless_set exception
Diffstat (limited to 'src/session.ml')
-rw-r--r-- | src/session.ml | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/session.ml b/src/session.ml index c1f0bcc..24a8153 100644 --- a/src/session.ml +++ b/src/session.ml @@ -95,9 +95,12 @@ let set w s path = let value_behaviour = if RT.is_multi w.reference_tree refpath then CT.AddValue else CT.ReplaceValue in let op = CfgSet (path, value, value_behaviour) in let config = - apply_cfg_op op s.proposed_config |> - (fun c -> RT.set_tag_data w.reference_tree c path) |> - (fun c -> RT.set_leaf_data w.reference_tree c path) + try + apply_cfg_op op s.proposed_config |> + (fun c -> RT.set_tag_data w.reference_tree c path) |> + (fun c -> RT.set_leaf_data w.reference_tree c path) + with CT.Useless_set -> + raise (Session_error (Printf.sprintf "Useless set, path: %s" (string_of_op op))) in {s with proposed_config=config; changeset=(op :: s.changeset)} |