diff options
author | Enrico Tassi <Enrico.Tassi@inria.fr> | 2014-02-21 18:22:27 +0100 |
---|---|---|
committer | Enrico Tassi <Enrico.Tassi@inria.fr> | 2014-02-26 14:53:08 +0100 |
commit | 9232c8618eebdcd223fe8eddaa5f46fab0bce95e (patch) | |
tree | 4a2e9f5049dfd4c908dace8524056e11216e9158 /checker/votour.ml | |
parent | f1e1452841997c08217bd4caf1da8370f17c93f3 (diff) |
votour: better error messages
Diffstat (limited to 'checker/votour.ml')
-rw-r--r-- | checker/votour.ml | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/checker/votour.ml b/checker/votour.ml index 3f82b638f..2634e8448 100644 --- a/checker/votour.ml +++ b/checker/votour.ml @@ -18,7 +18,7 @@ let to_dyn obj = (Obj.magic obj : dyn) let rec get_name ?(extra=false) = function |Any -> "?" - |Fail _ -> assert false + |Fail s -> "Invalid node: "^s |Tuple (name,_) -> name |Sum (name,_,_) -> name |Array v -> "array"^(if extra then "/"^get_name ~extra v else "") @@ -89,7 +89,7 @@ let rec get_children v o pos = match v with let t = to_dyn o in let tpe = find_dyn t.dyn_tag in [|(String, Obj.repr t.dyn_tag, 0 :: pos); (tpe, t.dyn_obj, 1 :: pos)|] - |Fail _ -> assert false + |Fail s -> failwith "forbidden" type info = { nam : string; @@ -131,7 +131,10 @@ let rec visit v o pos = let v',o',pos' = children.(int_of_string l) in push (get_name v) v o pos; visit v' o' pos' - with Failure _ | Invalid_argument _ -> visit v o pos + with + | Failure "empty stack" -> () + | Failure "forbidden" -> let info = pop () in visit info.typ info.obj info.pos + | Failure _ | Invalid_argument _ -> visit v o pos (** Loading the vo *) |