aboutsummaryrefslogtreecommitdiff
path: root/engine/proofview.ml
diff options
context:
space:
mode:
authorEmilio Jesus Gallego Arias2020-01-31 15:57:45 +0100
committerEmilio Jesus Gallego Arias2020-02-24 12:24:40 -0500
commitc216daf5d5f8215947bce10e55d30c35be1a56ba (patch)
treed8b7eaf494bf01ee63d462d54ff85a67359f7c2a /engine/proofview.ml
parent46fe9b26ad55a266b71bbd428ee406b03a9db030 (diff)
[exn] Forbid raising in exn printers, make them return Pp.t option
Raising inside exception printers is quite tricky as the order of registration for printers will indeed depend on the linking order. We thus forbid this, and make our API closer to the upstream `Printexn` by having printers return an option type.
Diffstat (limited to 'engine/proofview.ml')
-rw-r--r--engine/proofview.ml19
1 files changed, 10 insertions, 9 deletions
diff --git a/engine/proofview.ml b/engine/proofview.ml
index b0ea75ac60..31e4dae2de 100644
--- a/engine/proofview.ml
+++ b/engine/proofview.ml
@@ -303,8 +303,8 @@ let tclONCE = Proof.once
exception MoreThanOneSuccess
let _ = CErrors.register_handler begin function
| MoreThanOneSuccess ->
- Pp.str "This tactic has more than one success."
- | _ -> raise CErrors.Unhandled
+ Some (Pp.str "This tactic has more than one success.")
+ | _ -> None
end
(** [tclEXACTLY_ONCE e t] succeeds as [t] if [t] has exactly one
@@ -348,8 +348,8 @@ exception NoSuchGoals of int
let _ = CErrors.register_handler begin function
| NoSuchGoals n ->
- str "No such " ++ str (String.plural n "goal") ++ str "."
- | _ -> raise CErrors.Unhandled
+ Some (str "No such " ++ str (String.plural n "goal") ++ str ".")
+ | _ -> None
end
(** [tclFOCUS ?nosuchgoal i j t] applies [t] in a context where
@@ -421,9 +421,10 @@ exception SizeMismatch of int*int
let _ = CErrors.register_handler begin function
| SizeMismatch (i,j) ->
let open Pp in
- str"Incorrect number of goals" ++ spc() ++
- str"(expected "++int i++str(String.plural i " tactic") ++ str", was given "++ int j++str")."
- | _ -> raise CErrors.Unhandled
+ Some (
+ str"Incorrect number of goals" ++ spc() ++
+ str"(expected "++int i++str(String.plural i " tactic") ++ str", was given "++ int j++str").")
+ | _ -> None
end
(** A variant of [Monad.List.iter] where we iter over the focused list
@@ -908,8 +909,8 @@ let tclPROGRESS t =
let _ = CErrors.register_handler begin function
| Logic_monad.Tac_Timeout ->
- Pp.str "[Proofview.tclTIMEOUT] Tactic timeout!"
- | _ -> raise CErrors.Unhandled
+ Some (Pp.str "[Proofview.tclTIMEOUT] Tactic timeout!")
+ | _ -> None
end
let tclTIMEOUT n t =