diff options
| author | 2021-08-13 15:45:59 -0400 | |
|---|---|---|
| committer | 2021-08-13 15:46:13 -0400 | |
| commit | 64b934f390a6a1db026e5d82e5c31b0412ce0853 (patch) | |
| tree | d55e281a05d8fbd3b402efa3931ee5f71e1c37e9 /elements.ml | |
| parent | add documentation; add search over atomic number (diff) | |
use Arg.bad instead of Failure exception when positional atomic number arguments
Diffstat (limited to '')
| -rw-r--r-- | elements.ml | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/elements.ml b/elements.ml index 846b0f0..b5a778b 100644 --- a/elements.ml +++ b/elements.ml @@ -32,7 +32,10 @@ module Opts = struct let add_def s = match !ltype with | NAME -> add_name s | SYMB -> add_symb s - | NUMB -> add_numb (int_of_string s) + | NUMB -> add_numb (match int_of_string_opt s with + | None -> raise (Bad (Printf.sprintf "expected integer, got '%s'" s)) + | Some x -> x + ) let msg = "Periodic table search\n\ elements -gendb file [-dbfile outfile]\n\ |
