Skip to content

Misplaced return in NAPI_CALL example? #49311

@misterfish

Description

@misterfish

Affected URL(s)

https://nodejs.org/api/n-api.html#usage

Description of the problem

Shouldn't return NULL be moved outside of the if block in the NAPI_CALL macro? Like this:

if (!is_pending) {                                          \
  ...                                                       \
  napi_throw_error((env), NULL, message);                   \
  /* return NULL;  */                                       \
}                                                           \
return NULL;                                                \

Otherwise the user's function will continue and may result in more napi calls.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to the documentations.node-apiIssues and PRs related to the Node-API.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions