forked from lirantal/lockfile-lint
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 馃幐 Add custom error which outputs the package name too
Closes: lirantal#9
- Loading branch information
1 parent
76a5b3c
commit 0904df3
Showing
7 changed files
with
73 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use strict' | ||
|
||
module.exports = class PackageError extends Error { | ||
/** | ||
* constructor | ||
* @param {string} packageName - the name of the package where the error occured | ||
* @param {string} error - the original error object | ||
*/ | ||
constructor (packageName = '', error = {}) { | ||
super() | ||
this.name = error.name || 'Error' | ||
this.message = `Encountered error ${error.message} in package: "${packageName}"` | ||
this.stack = error.stack | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters