Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Commit 8c32eae

Browse files
committed
[interpreter] Handle exceptions in the script runner
1 parent 8cece8d commit 8c32eae

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

interpreter/script/run.ml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ let input_from get_script run =
112112
| Eval.Trap (at, msg) -> error at "runtime trap" msg
113113
| Eval.Exhaustion (at, msg) -> error at "resource exhaustion" msg
114114
| Eval.Crash (at, msg) -> error at "runtime crash" msg
115+
| Eval.Exception (at, msg) -> error at "uncaught exception" msg
115116
| Encode.Code (at, msg) -> error at "encoding error" msg
116117
| Script.Error (at, msg) -> error at "script error" msg
117118
| IO (at, msg) -> error at "i/o error" msg
@@ -458,7 +459,12 @@ let run_assertion ass =
458459
| _ -> Assert.error ass.at "expected runtime error"
459460
)
460461

461-
| AssertUncaughtException act -> () (* TODO *)
462+
| AssertUncaughtException act ->
463+
trace ("Asserting exception...");
464+
(match run_action act with
465+
| exception Eval.Exception (_, msg) -> ()
466+
| _ -> Assert.error ass.at "expected exception"
467+
)
462468

463469
| AssertExhaustion (act, re) ->
464470
trace ("Asserting exhaustion...");

0 commit comments

Comments
 (0)