Skip to content

Commit fb6e1e6

Browse files
authored
fix: set path on errors when possible (#893)
Signed-off-by: Sebastian Malton <[email protected]> Signed-off-by: Sebastian Malton <[email protected]>
1 parent f27d4b7 commit fb6e1e6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/volume.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,11 @@ function formatError(errorCode: string, func = '', path = '', path2 = '') {
141141
function createError(errorCode: string, func = '', path = '', path2 = '', Constructor = Error) {
142142
const error = new Constructor(formatError(errorCode, func, path, path2));
143143
(error as any).code = errorCode;
144+
145+
if (path) {
146+
(error as any).path = path;
147+
}
148+
144149
return error;
145150
}
146151

0 commit comments

Comments
 (0)