File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,17 @@ export class InterruptFlag {
21
21
return this . interrupted ;
22
22
}
23
23
24
+ /**
25
+ * Perform a checkpoint; reject immediately if an interruption has already
26
+ * occurred, and resolve immediately otherwise. This is useful to insert
27
+ * in operations consisting of multiple asynchronous steps.
28
+ */
29
+ public async checkpoint ( ) : Promise < void > {
30
+ if ( this . interrupted ) {
31
+ await this . asPromise ( ) . promise ;
32
+ }
33
+ }
34
+
24
35
/**
25
36
* The returned promise will never be resolved but is rejected
26
37
* when the interrupt is set. The rejection happens with an
Original file line number Diff line number Diff line change @@ -63,7 +63,11 @@ class ShellEvaluator<EvaluationResultType = ShellResult> {
63
63
rewrittenInput = supportCode + ';\n' + rewrittenInput ;
64
64
}
65
65
66
- return await originalEval ( rewrittenInput , context , filename ) ;
66
+ try {
67
+ return await originalEval ( rewrittenInput , context , filename ) ;
68
+ } catch ( err ) {
69
+ throw this . internalState . transformError ( err ) ;
70
+ }
67
71
}
68
72
69
73
/**
You can’t perform that action at this time.
0 commit comments