diff options
| author | Pierre-Marie Pédrot | 2020-05-16 13:57:58 +0200 |
|---|---|---|
| committer | Pierre-Marie Pédrot | 2020-05-16 13:57:58 +0200 |
| commit | ebaaa7371c3a3548ccec1836621726f6d829858a (patch) | |
| tree | f5bfbfa5ad485e7c2f7b680de794b2005506bef9 /interp/modintern.ml | |
| parent | 2111994285a21df662c232fa5acfd60e8a640795 (diff) | |
| parent | 8fd01b538c5b4ea58eecf8be07ab8115619cca4d (diff) | |
Merge PR #11566: [misc] Better preserve backtraces in several modules
Ack-by: SkySkimmer
Reviewed-by: ppedrot
Diffstat (limited to 'interp/modintern.ml')
| -rw-r--r-- | interp/modintern.ml | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/interp/modintern.ml b/interp/modintern.ml index ae152e1c1c..50f90ebea7 100644 --- a/interp/modintern.ml +++ b/interp/modintern.ml @@ -22,14 +22,15 @@ exception ModuleInternalizationError of module_internalization_error type module_kind = Module | ModType | ModAny -let error_not_a_module_loc kind loc qid = +let error_not_a_module_loc ~info kind loc qid = let s = string_of_qualid qid in let e = match kind with | Module -> Modops.ModuleTypingError (Modops.NotAModule s) | ModType -> Modops.ModuleTypingError (Modops.NotAModuleType s) | ModAny -> ModuleInternalizationError (NotAModuleNorModtype s) in - Loc.raise ?loc e + let info = Option.cata (Loc.add_loc info) info loc in + Exninfo.iraise (e,info) let error_application_to_not_path loc me = Loc.raise ?loc (Modops.ModuleTypingError (Modops.ApplicationToNotPath me)) @@ -57,7 +58,9 @@ let lookup_module_or_modtype kind qid = if kind == Module then raise Not_found; let mp = Nametab.locate_modtype qid in Dumpglob.dump_modref ?loc mp "mod"; (mp,ModType) - with Not_found -> error_not_a_module_loc kind loc qid + with Not_found as exn -> + let _, info = Exninfo.capture exn in + error_not_a_module_loc ~info kind loc qid let lookup_module lqid = fst (lookup_module_or_modtype Module lqid) |
