use Arg.bad instead of Failure exception when positional atomic number arguments
This commit is contained in:
parent
21f92ff9a2
commit
64b934f390
|
@ -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\
|
||||||
|
|
Loading…
Reference in New Issue