Skip to content

Commit c9bb098

Browse files
committed
Lin: Print commands that trigger uncaught exceptions
The standard QCheck mechanism to catch exceptions that are raised in tests do not give much clue about the source (ie Lin command) of that exception This packs the unsoundly-specified command with the exception in such a case so that it can be displayed Before: ``` exception Failure("unexpected") ``` After: ``` exception Failure("unexpected") raised but not caught while running always_fail t ```
1 parent 7747f9b commit c9bb098

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/lin.ml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,8 @@ module MakeCmd (ApiSpec : Spec) : Internal.CmdSpec = struct
479479
apply_f (f arg) rem state
480480

481481
let run cmd state =
482-
let Cmd { args ; rty ; f ; _ } = cmd in
483-
Res (rty, apply_f f args state)
482+
try
483+
let (Cmd { args; rty; f; _ }) = cmd in
484+
Res (rty, apply_f f args state)
485+
with e -> Util.wrap_uncaught_exn show_cmd cmd e
484486
end

0 commit comments

Comments
 (0)