1995-08-09 08:06:35 -07:00
|
|
|
(***********************************************************************)
|
|
|
|
(* *)
|
2011-07-27 07:17:02 -07:00
|
|
|
(* OCaml *)
|
1995-08-09 08:06:35 -07:00
|
|
|
(* *)
|
|
|
|
(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
|
|
|
|
(* *)
|
1996-04-30 07:53:58 -07:00
|
|
|
(* Copyright 1996 Institut National de Recherche en Informatique et *)
|
1999-11-17 10:59:06 -08:00
|
|
|
(* en Automatique. All rights reserved. This file is distributed *)
|
|
|
|
(* under the terms of the Q Public License version 1.0. *)
|
1995-08-09 08:06:35 -07:00
|
|
|
(* *)
|
|
|
|
(***********************************************************************)
|
|
|
|
|
2001-06-15 12:09:45 -07:00
|
|
|
(* WARNING: if you change something in this file, you must look at
|
2007-12-04 05:38:58 -08:00
|
|
|
opterrors.ml and ocamldoc/odoc_analyse.ml
|
|
|
|
to see if you need to make the same changes there.
|
2001-06-15 12:09:45 -07:00
|
|
|
*)
|
2000-10-31 06:55:30 -08:00
|
|
|
|
2001-06-15 12:09:45 -07:00
|
|
|
open Format
|
1995-05-04 03:15:53 -07:00
|
|
|
|
|
|
|
(* Report an error *)
|
|
|
|
|
2000-03-06 14:12:09 -08:00
|
|
|
let report_error ppf exn =
|
|
|
|
let report ppf = function
|
2002-11-01 09:06:47 -08:00
|
|
|
| Lexer.Error(err, loc) ->
|
2007-12-04 05:38:58 -08:00
|
|
|
Location.print_error ppf loc;
|
2000-03-06 14:12:09 -08:00
|
|
|
Lexer.report_error ppf err
|
1997-08-22 01:55:41 -07:00
|
|
|
| Syntaxerr.Error err ->
|
2000-03-06 14:12:09 -08:00
|
|
|
Syntaxerr.report_error ppf err
|
2013-01-25 01:12:31 -08:00
|
|
|
| Pparse.Error err ->
|
|
|
|
Pparse.report_error ppf err
|
1995-05-04 03:15:53 -07:00
|
|
|
| Env.Error err ->
|
2007-12-04 05:38:58 -08:00
|
|
|
Location.print_error_cur_file ppf;
|
2000-03-06 14:12:09 -08:00
|
|
|
Env.report_error ppf err
|
2012-05-30 07:52:37 -07:00
|
|
|
| Cmi_format.Error err ->
|
|
|
|
Location.print_error_cur_file ppf;
|
|
|
|
Cmi_format.report_error ppf err
|
2007-12-04 05:38:58 -08:00
|
|
|
| Ctype.Tags(l, l') ->
|
|
|
|
Location.print_error_cur_file ppf;
|
|
|
|
fprintf ppf
|
2000-03-06 14:12:09 -08:00
|
|
|
"In this program,@ variant constructors@ `%s and `%s@ \
|
2002-01-03 18:02:50 -08:00
|
|
|
have the same hash value.@ Change one of them." l l'
|
2012-01-21 19:15:14 -08:00
|
|
|
| Typecore.Error(loc, env, err) ->
|
|
|
|
Location.print_error ppf loc; Typecore.report_error env ppf err
|
2013-01-29 06:21:12 -08:00
|
|
|
| Typetexp.Error(loc, env, err) ->
|
|
|
|
Location.print_error ppf loc; Typetexp.report_error env ppf err
|
1995-05-04 03:15:53 -07:00
|
|
|
| Typedecl.Error(loc, err) ->
|
2007-12-04 05:38:58 -08:00
|
|
|
Location.print_error ppf loc; Typedecl.report_error ppf err
|
2012-01-21 19:15:14 -08:00
|
|
|
| Typeclass.Error(loc, env, err) ->
|
|
|
|
Location.print_error ppf loc; Typeclass.report_error env ppf err
|
1995-05-04 03:15:53 -07:00
|
|
|
| Includemod.Error err ->
|
2007-12-04 05:38:58 -08:00
|
|
|
Location.print_error_cur_file ppf;
|
2000-03-06 14:12:09 -08:00
|
|
|
Includemod.report_error ppf err
|
2012-01-22 23:59:45 -08:00
|
|
|
| Typemod.Error(loc, env, err) ->
|
|
|
|
Location.print_error ppf loc; Typemod.report_error env ppf err
|
1995-05-04 03:15:53 -07:00
|
|
|
| Translcore.Error(loc, err) ->
|
2007-12-04 05:38:58 -08:00
|
|
|
Location.print_error ppf loc; Translcore.report_error ppf err
|
2003-06-19 08:53:53 -07:00
|
|
|
| Translclass.Error(loc, err) ->
|
2007-12-04 05:38:58 -08:00
|
|
|
Location.print_error ppf loc; Translclass.report_error ppf err
|
2003-06-19 08:53:53 -07:00
|
|
|
| Translmod.Error(loc, err) ->
|
2007-12-04 05:38:58 -08:00
|
|
|
Location.print_error ppf loc; Translmod.report_error ppf err
|
1995-05-04 03:15:53 -07:00
|
|
|
| Symtable.Error code ->
|
2007-12-04 05:38:58 -08:00
|
|
|
Location.print_error_cur_file ppf;
|
2000-03-06 14:12:09 -08:00
|
|
|
Symtable.report_error ppf code
|
1995-07-02 09:45:41 -07:00
|
|
|
| Bytelink.Error code ->
|
2007-12-04 05:38:58 -08:00
|
|
|
Location.print_error_cur_file ppf;
|
2000-03-06 14:12:09 -08:00
|
|
|
Bytelink.report_error ppf code
|
1995-07-11 11:07:53 -07:00
|
|
|
| Bytelibrarian.Error code ->
|
2007-12-04 05:38:58 -08:00
|
|
|
Location.print_error_cur_file ppf;
|
2000-03-06 14:12:09 -08:00
|
|
|
Bytelibrarian.report_error ppf code
|
2002-02-08 08:55:44 -08:00
|
|
|
| Bytepackager.Error code ->
|
2007-12-04 05:38:58 -08:00
|
|
|
Location.print_error_cur_file ppf;
|
2002-02-08 08:55:44 -08:00
|
|
|
Bytepackager.report_error ppf code
|
1995-05-04 03:15:53 -07:00
|
|
|
| Sys_error msg ->
|
2007-12-04 05:38:58 -08:00
|
|
|
Location.print_error_cur_file ppf;
|
2000-03-06 14:12:09 -08:00
|
|
|
fprintf ppf "I/O error: %s" msg
|
2000-08-23 10:13:17 -07:00
|
|
|
| Warnings.Errors (n) ->
|
2007-12-04 05:38:58 -08:00
|
|
|
Location.print_error_cur_file ppf;
|
|
|
|
fprintf ppf "Error-enabled warnings (%d occurrences)" n
|
2000-03-07 17:48:22 -08:00
|
|
|
| x -> fprintf ppf "@]"; raise x in
|
2000-03-06 14:12:09 -08:00
|
|
|
|
|
|
|
fprintf ppf "@[%a@]@." report exn
|