diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2017-11-21 04:47:57 +0800 |
---|---|---|
committer | Joyee Cheung <joyeec9h3@gmail.com> | 2017-11-25 22:33:42 +0900 |
commit | 07d34092b117c4b5bdad85cf916d9ae5e213651d (patch) | |
tree | eb4a17da4c4bdbb23dd3c7893804a6d8191b2b2d /test/parallel/test-fs-buffer.js | |
parent | 73154c0341145985ac7e9b61841a58805d82f533 (diff) | |
download | android-node-v8-07d34092b117c4b5bdad85cf916d9ae5e213651d.tar.gz android-node-v8-07d34092b117c4b5bdad85cf916d9ae5e213651d.tar.bz2 android-node-v8-07d34092b117c4b5bdad85cf916d9ae5e213651d.zip |
fs: throw fs.access errors in JS
- Migrate the type check of path to ERR_INVALID_ARG_TYPE
- Add template counterparts of ASYNC_CALL, ASYNC_DEST_CALL,
SYNC_CALL, SYNC_DEST_CALL
- Port StringFromPath and UVException to JavaScript
- Migrate the access binding to collect the error context in C++,
then throw the error in JS
PR-URL: https://github.com/nodejs/node/pull/17160
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-fs-buffer.js')
-rw-r--r-- | test/parallel/test-fs-buffer.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/test/parallel/test-fs-buffer.js b/test/parallel/test-fs-buffer.js index 1cbead4344..bc2add5218 100644 --- a/test/parallel/test-fs-buffer.js +++ b/test/parallel/test-fs-buffer.js @@ -25,9 +25,16 @@ assert.doesNotThrow(() => { })); }); -assert.throws(() => { - fs.accessSync(true); -}, /path must be a string or Buffer/); +common.expectsError( + () => { + fs.accessSync(true); + }, + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError, + message: 'The "path" argument must be one of type string, Buffer, or URL' + } +); const dir = Buffer.from(fixtures.fixturesDir); fs.readdir(dir, 'hex', common.mustCall((err, hexList) => { |