File tree Expand file tree Collapse file tree 5 files changed +610
-46
lines changed Expand file tree Collapse file tree 5 files changed +610
-46
lines changed Original file line number Diff line number Diff line change @@ -179,7 +179,7 @@ export function runInContext(
179
179
value : sandboxedEval ( transpiled )
180
180
} as Result )
181
181
} catch ( error ) {
182
- if ( error instanceof RuntimeSourceError ) {
182
+ if ( error instanceof RuntimeSourceError || error instanceof ExceptionError ) {
183
183
context . errors . push ( error )
184
184
return resolvedErrorPromise
185
185
}
Original file line number Diff line number Diff line change @@ -614,9 +614,10 @@ export function* apply(
614
614
break
615
615
} catch ( e ) {
616
616
// Recover from exception
617
- const globalEnvironment =
618
- context . runtime . environments [ context . runtime . environments . length - 1 ]
619
- context . runtime . environments = [ globalEnvironment ]
617
+ context . runtime . environments = context . runtime . environments . slice (
618
+ - context . numberOfOuterEnvironments
619
+ )
620
+
620
621
const loc = node ? node . loc ! : constants . UNKNOWN_LOCATION
621
622
if ( ! ( e instanceof errors . RuntimeSourceError ) ) {
622
623
// The error could've arisen when the builtin called a source function which errored.
You can’t perform that action at this time.
0 commit comments