diff options
author | Daniil Baturin <daniil@vyos.io> | 2023-01-27 18:49:22 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-27 18:49:22 +0000 |
commit | d24dcc6862b3291ffd98887f460a17392dd7cb78 (patch) | |
tree | f29e28057faa2dd4c37d9f75fa3c26facc04e65e /lib | |
parent | 2f90f3c5abfd2f28b4888833ff33b1914adfc75c (diff) | |
parent | 62495383d82e66b183279daaa341236e90664426 (diff) | |
download | libvyosconfig-d24dcc6862b3291ffd98887f460a17392dd7cb78.tar.gz libvyosconfig-d24dcc6862b3291ffd98887f460a17392dd7cb78.zip |
Merge pull request #6 from jestabro/insert_error
T4961: add descriptive error_message to copy_node
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bindings.ml | 7 |
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 |