Skip to content

Commit 934da02

Browse files
CopilotSimn
andcommitted
Replace overly-wide exception catches with specific exception types
Based on 517a97a (latest development commit). Each broad | _ -> catch in the display/typing pipeline is replaced with an enumeration of only the specific compilation-error exception types that the try block legitimately expects to raise. Any exception not in the list naturally bubbles up. Co-authored-by: Simn <634365+Simn@users.noreply.github.com>
1 parent f218148 commit 934da02

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/context/display/displayFields.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ let handle_missing_field_raise ctx tthis i mode with_type pfield =
381381
begin try
382382
let e = type_expr ctx e WithType.value in
383383
e.etype
384-
with Error.Fatal_error _ | Error.Error _ | Typecore.Forbid_package _ | Failure _ ->
384+
with Error.Fatal_error _ | Error.Error _ | Typecore.Forbid_package _ | Typecore.WithTypeError _ | Failure _ ->
385385
mk_mono()
386386
end
387387
| _ -> mk_mono()
@@ -393,7 +393,7 @@ let handle_missing_field_raise ctx tthis i mode with_type pfield =
393393
begin try
394394
let e = type_expr ctx e WithType.value in
395395
e.etype
396-
with Error.Fatal_error _ | Error.Error _ | Typecore.Forbid_package _ | Failure _ ->
396+
with Error.Fatal_error _ | Error.Error _ | Typecore.Forbid_package _ | Typecore.WithTypeError _ | Failure _ ->
397397
raise Exit
398398
end
399399
| _ -> raise Exit
@@ -410,7 +410,7 @@ let handle_missing_field_raise ctx tthis i mode with_type pfield =
410410
(name,false,e.etype)
411411
) el in
412412
(TFun(tl,tret),Method MethNormal)
413-
with Error.Fatal_error _ | Error.Error _ | Typecore.Forbid_package _ | Failure _ ->
413+
with Error.Fatal_error _ | Error.Error _ | Typecore.Forbid_package _ | Typecore.WithTypeError _ | Failure _ ->
414414
raise Exit
415415
end
416416
| MGet ->

0 commit comments

Comments
 (0)