feat(runtime): improve error messages of runtime fs (#11984)

This commit annotates errors returned from FS Deno APIs to include
paths that were passed to the API calls.

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
This commit is contained in:
Feng Yu 2021-10-11 21:21:18 +08:00 committed by GitHub
parent 423b02d889
commit 668b400ff2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 589 additions and 135 deletions

View file

@ -59,15 +59,23 @@ unitTest(
);
unitTest({ permissions: { write: true } }, function mkdirErrSyncIfExists() {
assertThrows(() => {
Deno.mkdirSync(".");
}, Deno.errors.AlreadyExists);
assertThrows(
() => {
Deno.mkdirSync(".");
},
Deno.errors.AlreadyExists,
`mkdir '.'`,
);
});
unitTest({ permissions: { write: true } }, async function mkdirErrIfExists() {
await assertRejects(async () => {
await Deno.mkdir(".");
}, Deno.errors.AlreadyExists);
await assertRejects(
async () => {
await Deno.mkdir(".");
},
Deno.errors.AlreadyExists,
`mkdir '.'`,
);
});
unitTest(