summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2023-01-26 17:53:27 -0600
committerJohn Estabrook <jestabro@vyos.io>2023-01-27 12:47:44 -0600
commit62495383d82e66b183279daaa341236e90664426 (patch)
treef29e28057faa2dd4c37d9f75fa3c26facc04e65e
parent2f90f3c5abfd2f28b4888833ff33b1914adfc75c (diff)
downloadlibvyosconfig-62495383d82e66b183279daaa341236e90664426.tar.gz
libvyosconfig-62495383d82e66b183279daaa341236e90664426.zip
T4961: add descriptive error_message to copy_node
-rw-r--r--lib/bindings.ml7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/bindings.ml b/lib/bindings.ml
index d9d2051..61f65cd 100644
--- a/lib/bindings.ml
+++ b/lib/bindings.ml
@@ -157,13 +157,18 @@ let return_values c_ptr path =
let copy_node c_ptr old_path new_path =
let ct = Root.get c_ptr in
+ let old_path_str = old_path in
let old_path = split_on_whitespace old_path in
let new_path = split_on_whitespace new_path in
try
let new_ct = Vytree.copy ct old_path new_path in
Root.set c_ptr new_ct;
0
- with Vytree.Nonexistent_path -> 1
+ with
+ | Vytree.Nonexistent_path ->
+ let s = Printf.sprintf "Non-existent path \'%s\'" old_path_str in
+ error_message := s; 1
+ | Vytree.Insert_error s -> error_message := s; 1
let diff_tree path c_ptr_l c_ptr_r =
let path = split_on_whitespace path in