Replace failwith by internal errors

This commit is contained in:
vbot 2024-06-18 16:26:59 +02:00
parent 37945f189b
commit 62470d0db8
No known key found for this signature in database
GPG Key ID: A102739F983C6C72

View File

@ -413,7 +413,7 @@ let delayed_error x =
make ~level:Error ~cont:(fun m _ ->
match !global_errors with
| None ->
failwith
error ~internal:true
"delayed error called outside scope: encapsulate using \
'with_delayed_errors' first"
| Some l ->
@ -423,10 +423,13 @@ let delayed_error x =
let with_delayed_errors (f : unit -> 'a) : 'a =
(match !global_errors with
| None -> global_errors := Some []
| Some _ -> failwith "delayed error scope already initialized");
| Some _ ->
error ~internal:true
"delayed error called outside scope: encapsulate using \
'with_delayed_errors' first");
let r = f () in
match !global_errors with
| None -> assert false
| None -> error ~internal:true "intertwined delayed error scope"
| Some [] ->
global_errors := None;
r