Skip to content

errors: should we raise assersions for type checks in process.bindings? #17244

Closed
@joyeecheung

Description

@joyeecheung

To migrate the errors thrown in C++ land we currently try to collect the context in C++ then throw the actual errors in JS using utilities in internal/errors.js. The current pattern would replace code like

if (!args.Length() < 1) {
   env->ThrowError(...)
}

with

CHECK(args.Length() >= 1);

and enforce the type checks with ->To*(context).ToLocalChecked().

The JS layer would do the checks in advance and make sure the bindings are invoked correctly, but if there are people using process.bindings() with wrong types of objects, previously they got errors, now they would get assersions.

This issues is to make sure we are OK with this path forward. Otherwise we need to somehow port the stuff in internal/errors.js back to C++ land for migrating those errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    errorsIssues and PRs related to JavaScript errors originated in Node.js core.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions