Skip to content

Commit dc3f2ed

Browse files
committed
Wrapped the declare_object function to pretty-print anomalies at loading time.
1 parent a110da8 commit dc3f2ed

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

library/libobject.ml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,13 @@ let declare_object_full odecl =
101101
dyn_rebuild_function = rebuild };
102102
(infun,outfun)
103103

104-
let declare_object odecl = fst (declare_object_full odecl)
104+
(* The "try .. with .. " allows for correct printing when calling
105+
declare_object a loading time.
106+
*)
107+
108+
let declare_object odecl =
109+
try fst (declare_object_full odecl)
110+
with e -> Errors.fatal_error (Errors.print e) (Errors.is_anomaly e)
105111

106112
let missing_tab = (Hashtbl.create 17 : (string, unit) Hashtbl.t)
107113

0 commit comments

Comments
 (0)