File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -431,15 +431,17 @@ let on_boot_to_string onboot =
431431 | `reset -> " reset"
432432 | `persist -> " persist"
433433
434+ let wrap f err x = try f x with _ -> err x
435+ let generic_error x = raise (Record_failure (" Unknown value: " ^ x))
434436let rpc_to_string = function | Rpc. String s -> s | _ -> failwith " Bad RPC type in record_util"
435437let backup_type_to_string t = rpc_to_string (API. rpc_of_vmpp_backup_type t)
436- let string_to_backup_type s = API. vmpp_backup_type_of_rpc (Rpc. String s)
438+ let string_to_backup_type = wrap ( fun s -> API. vmpp_backup_type_of_rpc (Rpc. String s)) generic_error
437439let backup_frequency_to_string t = rpc_to_string (API. rpc_of_vmpp_backup_frequency t)
438- let string_to_backup_frequency s = API. vmpp_backup_frequency_of_rpc (Rpc. String s)
440+ let string_to_backup_frequency = wrap ( fun s -> API. vmpp_backup_frequency_of_rpc (Rpc. String s)) generic_error
439441let archive_frequency_to_string t = rpc_to_string (API. rpc_of_vmpp_archive_frequency t)
440- let string_to_archive_frequency s = API. vmpp_archive_frequency_of_rpc (Rpc. String s)
442+ let string_to_archive_frequency = wrap ( fun s -> API. vmpp_archive_frequency_of_rpc (Rpc. String s)) generic_error
441443let archive_target_type_to_string t = rpc_to_string (API. rpc_of_vmpp_archive_target_type t)
442- let string_to_archive_target_type s = API. vmpp_archive_target_type_of_rpc (Rpc. String s)
444+ let string_to_archive_target_type = wrap ( fun s -> API. vmpp_archive_target_type_of_rpc (Rpc. String s)) generic_error
443445
444446(* * Parse a string which might have a units suffix on the end *)
445447let bytes_of_string field x =
You can’t perform that action at this time.
0 commit comments