Skip to content

Commit

Permalink
Make all Invalid_argument critical (not just equal: functional value)
Browse files Browse the repository at this point in the history
Catching invalid_argument without the specific Invalid_argument
pattern seems more likely to hide bugs than not.
  • Loading branch information
SkySkimmer committed Sep 6, 2023
1 parent 0fd0bca commit 92a1f20
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/cErrors.ml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ let print_no_report e = iprint_no_report (e, Exninfo.info e)

(** Predefined handlers **)

let _ = register_handler begin function
let () = register_handler begin function
| UserError pps ->
Some pps
| _ -> None
Expand All @@ -149,11 +149,8 @@ let _ = register_handler begin function
by inner functions during a [vernacinterp]. They should be handled
only at the very end of interp, to be displayed to the user. *)

[@@@ocaml.warning "-52"]
let noncritical = function
| Sys.Break | Out_of_memory | Stack_overflow
| Assert_failure _ | Match_failure _ | Anomaly _
| Control.Timeout -> false
| Invalid_argument "equal: functional value" -> false
| Control.Timeout | Invalid_argument _ -> false
| _ -> true
[@@@ocaml.warning "+52"]

0 comments on commit 92a1f20

Please sign in to comment.