diff options
author | Philipp Gesang <phg@phi-gamma.net> | 2018-10-29 00:48:03 +0100 |
---|---|---|
committer | Philipp Gesang <phg@phi-gamma.net> | 2018-10-30 01:15:03 +0100 |
commit | 269cef804819e9aef1c2d6642b26c87f306cb176 (patch) | |
tree | b7a3b118ecafb06d7e3350690c3c99f52681f67a /util | |
parent | 7aa81d2a490e161082f3c38c9d0e806d841caca2 (diff) | |
download | ocaml-sid-269cef804819e9aef1c2d6642b26c87f306cb176.tar.gz |
sid: sid_test: move conversion functions to result
Get rid of all “StringFmt” APIs involving exceptions.
There is now only the “decode” function which returns
a result type.
Diffstat (limited to 'util')
-rw-r--r-- | util/sidparse.ml | 5 |
1 files changed, 3 insertions, 2 deletions
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 |