diff options
author | Alain Frisch <alain@frisch.fr> | 2013-09-11 14:26:52 +0000 |
---|---|---|
committer | Alain Frisch <alain@frisch.fr> | 2013-09-11 14:26:52 +0000 |
commit | dc7fa347cae7810fb193e369f330d1bff558a843 (patch) | |
tree | 06411d2fe416b2aca4ede846813397a0c535b9ed /driver/errors.ml | |
parent | 637893aa3cb4d2c5a3ab85191d79d6d8941be91c (diff) |
Experimenting with exception registration, to avoid explicit pattern matching on many exception constructors in 'driver' code.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14093 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'driver/errors.ml')
-rw-r--r-- | driver/errors.ml | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/driver/errors.ml b/driver/errors.ml index 14a1a23cb..5faa274da 100644 --- a/driver/errors.ml +++ b/driver/errors.ml @@ -39,8 +39,6 @@ let report_error ppf exn = fprintf ppf "In this program,@ variant constructors@ `%s and `%s@ \ have the same hash value.@ Change one of them." l l' - | Typecore.Error(loc, env, err) -> - Location.print_error ppf loc; Typecore.report_error env ppf err | Typetexp.Error(loc, env, err) -> Location.print_error ppf loc; Typetexp.report_error env ppf err | Typedecl.Error(loc, err) -> @@ -76,6 +74,10 @@ let report_error ppf exn = | Warnings.Errors (n) -> Location.print_error_cur_file ppf; fprintf ppf "Some fatal warnings were triggered (%d occurrences)" n - | x -> fprintf ppf "@]"; raise x in + | x -> + match Location.error_of_exn x with + | Some err -> Location.report_error ppf err + | None -> fprintf ppf "@]"; raise x + in fprintf ppf "@[%a@]@." report exn |