Skip to content

Error APIs should make it easy to supply an error code property #241

@jasongin

Description

@jasongin

From nodejs/node#12729 (comment)

Node.js errors by convention may have a code property with a value that can be tested programmatically, as a more reliable alternative to comparing error message strings. To encourage N-API add-ons to conform to that convention, we could add APIs like napi_create_error_with_code() and napi_throw_error_with_code() that take the code value as another parameter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions