From 7ad9d57cc783f6eacb7924e1af0e8aa20d468573 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Tue, 5 Jun 2018 16:19:54 -0700 Subject: [PATCH] Include filename when reporting not found --- src/harness/vfs.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/harness/vfs.ts b/src/harness/vfs.ts index 186f3610dc..0e16b0fe71 100644 --- a/src/harness/vfs.ts +++ b/src/harness/vfs.ts @@ -444,7 +444,7 @@ namespace vfs { private _stat(entry: WalkResult) { const node = entry.node; - if (!node) throw createIOError("ENOENT"); + if (!node) throw createIOError(`ENOENT`, entry.realpath); return new Stats( node.dev, node.ino, @@ -1155,8 +1155,8 @@ namespace vfs { EROFS: "file system is read-only" }); - export function createIOError(code: keyof typeof IOErrorMessages) { - const err: NodeJS.ErrnoException = new Error(`${code}: ${IOErrorMessages[code]}`); + export function createIOError(code: keyof typeof IOErrorMessages, details: string = "") { + const err: NodeJS.ErrnoException = new Error(`${code}: ${IOErrorMessages[code]} ${details}`); err.code = code; if (Error.captureStackTrace) Error.captureStackTrace(err, createIOError); return err;