[napi] properly initialize and check status (#12279)
Initialize status to napi_generic_failure and only check it after having made an actual N-API call.
This fixes up 8fbace16.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows commit guidelines
Affected core subsystem(s)
n-api