diff options
author | cjihrig <cjihrig@gmail.com> | 2019-12-22 20:05:39 +0300 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2019-12-26 06:27:11 +0300 |
commit | 208453ef42074e3d0df66c390c1fd699003f1249 (patch) | |
tree | 9544357c60f71963f66d7f0b1acd48ca569c8260 /test | |
parent | 6e20674c6f03ebe272e69cc3afb84db277163a7c (diff) |
wasi: throw on failed uvwasi_init()
Prior to this commit, if uvwasi_init() failed in any way, Node
would abort due to a failed CHECK_EQ(). This commit changes
that behavior to a thrown exception.
PR-URL: https://github.com/nodejs/node/pull/31076
Fixes: https://github.com/nodejs/node/issues/30878
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/wasi/test-wasi-options-validation.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/wasi/test-wasi-options-validation.js b/test/wasi/test-wasi-options-validation.js index f07046b833d..f0aa6932db4 100644 --- a/test/wasi/test-wasi-options-validation.js +++ b/test/wasi/test-wasi-options-validation.js @@ -26,3 +26,8 @@ assert.throws(() => { new WASI({ preopens: 'fhqwhgads' }); }, assert.throws(() => { new WASI(value); }, { code: 'ERR_INVALID_ARG_TYPE' }); }); + +// Verify that exceptions thrown from the binding layer are handled. +assert.throws(() => { + new WASI({ preopens: { '/sandbox': '__/not/real/path' } }); +}, { code: 'UVWASI_ENOENT', message: /uvwasi_init/ }); |