Skip to content

noexcept control flow issues #419

@DaAitch

Description

@DaAitch

I think there are two noexcept issues with control flow.

1. NAPI_THROW noexcept control flow

Like NAPI_THROW_IF_FAILED*, NAPI_THROW should also always abort control flow, but noexcept definition doesn't have a return so execution continues. All implementations using NAPI_THROW have a trailing return statement, so there is no bug, but I'd say it's unclean.

// for noexcept
#define NAPI_THROW(e)  (e).ThrowAsJavaScriptException();

2. noexcept ThrowAsJavaScriptException may produce infinite recursion

if napi_throw fails, it's likely that all further calls are failing and every time invoke another ThrowAsJavaScriptException, so I think this is a fatal case. Recursion is not a good idea, and also ignoring it, so it should fatal abort.

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