test: fix up N-API error test
Replace assert.throws() with an explicit try/catch in order to catch the thrown value and be able to compare it strictly to an expected value.
Re: https://github.com/nodejs/node/pull/20428#issuecomment-386160684
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines