From 269cef804819e9aef1c2d6642b26c87f306cb176 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Mon, 29 Oct 2018 00:48:03 +0100 Subject: sid: sid_test: move conversion functions to result MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Get rid of all “StringFmt” APIs involving exceptions. There is now only the “decode” function which returns a result type. --- util/sidparse.ml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'util') diff --git a/util/sidparse.ml b/util/sidparse.ml index 5ab6bf4..ba0efc2 100644 --- a/util/sidparse.ml +++ b/util/sidparse.ml @@ -31,8 +31,9 @@ let handle_input q v s = match String.trim s with | "" -> `Nothing | s -> - try `Done (Sid.of_string s) - with Invalid_argument e -> err q v "ERROR: %s\n%!" e; `Junk + (match Sid.of_string s with + | Ok s -> `Done s + | Error e -> err q v "ERROR: %s\n%!" e; `Junk) let from_argv sids = let rest = ref sids in -- cgit v1.2.3