Skip to content

Commit a862bf1

Browse files
authored
Merge branch 'master' into integer-arrays
2 parents 2cd2f3f + b0a96ef commit a862bf1

File tree

5 files changed

+610
-46
lines changed

5 files changed

+610
-46
lines changed

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ export function runInContext(
179179
value: sandboxedEval(transpiled)
180180
} as Result)
181181
} catch (error) {
182-
if (error instanceof RuntimeSourceError) {
182+
if (error instanceof RuntimeSourceError || error instanceof ExceptionError) {
183183
context.errors.push(error)
184184
return resolvedErrorPromise
185185
}

src/interpreter.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -614,9 +614,10 @@ export function* apply(
614614
break
615615
} catch (e) {
616616
// 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+
620621
const loc = node ? node.loc! : constants.UNKNOWN_LOCATION
621622
if (!(e instanceof errors.RuntimeSourceError)) {
622623
// The error could've arisen when the builtin called a source function which errored.

0 commit comments

Comments
 (0)