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\