use Arg.bad instead of Failure exception when positional atomic number arguments

This commit is contained in:
Peter McGoron 2021-08-13 15:45:59 -04:00
parent 21f92ff9a2
commit 64b934f390
1 changed files with 4 additions and 1 deletions

View File

@ -32,7 +32,10 @@ module Opts = struct
let add_def s = match !ltype with let add_def s = match !ltype with
| NAME -> add_name s | NAME -> add_name s
| SYMB -> add_symb 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\ let msg = "Periodic table search\n\
elements -gendb file [-dbfile outfile]\n\ elements -gendb file [-dbfile outfile]\n\