google / google/CodeCity

OldNativeFunction should catch exceptions thrown from native .impl and rethrow

Open
#457 0 comments 0 reactions 0 assignees View on GitHub
bug server
Dominant language
JavaScript
Stars
198
Forks
38
PR merge metrics
No merged PRs in 30d

Description

There are a small but non-zero number of native functions that we implement using `OldNativeFunction` (via `createNativeFunction`), including `String.prototype.localeCompare` that can throw (native) errors when given invalid arguments. This will cause the interpreter to crash.

These should probably ultimately be rewritten as (new) `NativeFunction`s, but in the interim `OldNativeFunction.prototype.call` and `.construct` should catch any native thrown by `this.impl.apply(…)` and rethrow the corresponding pseudo error generated by applying `errorNativeToPseudo`.

This is somewhat related to #456.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.