Skip to content

Misplaced return in NAPI_CALL example? #49311

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to Node.js documentation.node-apiIssues and PRs related to Node-API.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions