@visulima/fs
Version:
Human friendly file system utilities for Node.js
25 lines (23 loc) • 787 B
JavaScript
class WalkError extends Error {
/** File path of the root that's being walked. */
root;
/**
* Constructs a new instance.
* @param cause The underlying error or reason for the walk failure.
* @param root The root directory path where the walk operation started or encountered the error.
*/
constructor(cause, root) {
super(`${cause instanceof Error ? cause.message : cause} for path "${root}"`);
this.cause = cause;
this.root = root;
}
// eslint-disable-next-line class-methods-use-this
get name() {
return "WalkError";
}
// eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types
set name(_name) {
throw new Error("Cannot overwrite name of WalkError");
}
}
export { WalkError as default };