Skip to content

Commit

Permalink
fix: set path on errors when possible (#893)
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Malton <sebastian@malton.name>

Signed-off-by: Sebastian Malton <sebastian@malton.name>
  • Loading branch information
Nokel81 committed Jan 7, 2023
1 parent f27d4b7 commit fb6e1e6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/volume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ function formatError(errorCode: string, func = '', path = '', path2 = '') {
function createError(errorCode: string, func = '', path = '', path2 = '', Constructor = Error) {
const error = new Constructor(formatError(errorCode, func, path, path2));
(error as any).code = errorCode;

if (path) {
(error as any).path = path;
}

return error;
}

Expand Down

0 comments on commit fb6e1e6

Please sign in to comment.