aboutsummaryrefslogtreecommitdiff
path: root/proofs/proof.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 /proofs/proof.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 'proofs/proof.ml')
-rw-r--r--proofs/proof.ml18
1 files changed, 9 insertions, 9 deletions
diff --git a/proofs/proof.ml b/proofs/proof.ml
index e2ee5426b5..7d0b31734e 100644
--- a/proofs/proof.ml
+++ b/proofs/proof.ml
@@ -69,16 +69,16 @@ exception FullyUnfocused
let _ = CErrors.register_handler begin function
| CannotUnfocusThisWay ->
- Pp.str "This proof is focused, but cannot be unfocused this way"
+ Some (Pp.str "This proof is focused, but cannot be unfocused this way")
| NoSuchGoals (i,j) when Int.equal i j ->
- Pp.(str "[Focus] No such goal (" ++ int i ++ str").")
+ Some Pp.(str "[Focus] No such goal (" ++ int i ++ str").")
| NoSuchGoals (i,j) ->
- Pp.(str "[Focus] Not every goal in range ["++ int i ++ str","++int j++str"] exist.")
+ Some Pp.(str "[Focus] Not every goal in range ["++ int i ++ str","++int j++str"] exist.")
| NoSuchGoal id ->
- Pp.(str "[Focus] No such goal: " ++ str (Names.Id.to_string id) ++ str ".")
+ Some Pp.(str "[Focus] No such goal: " ++ str (Names.Id.to_string id) ++ str ".")
| FullyUnfocused ->
- Pp.str "The proof is not focused"
- | _ -> raise CErrors.Unhandled
+ Some (Pp.str "The proof is not focused")
+ | _ -> None
end
let check_cond_kind c k =
@@ -325,9 +325,9 @@ exception OpenProof of Names.Id.t option * open_error_reason
let _ = CErrors.register_handler begin function
| OpenProof (pid, reason) ->
let open Pp in
- Option.cata (fun pid ->
- str " (in proof " ++ Names.Id.print pid ++ str "): ") (mt()) pid ++ print_open_error_reason reason
- | _ -> raise CErrors.Unhandled
+ Some (Option.cata (fun pid ->
+ str " (in proof " ++ Names.Id.print pid ++ str "): ") (mt()) pid ++ print_open_error_reason reason)
+ | _ -> None
end
let warn_remaining_shelved_goals =