Skip to content

Commit 8482ead

Browse files
author
simonepri
committed
Update thrown behaviour
1 parent b4ce83b commit 8482ead

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ Type: `string`
109109
Default: `undefined`
110110
111111
The type of error that the object should be instance of.
112-
If undefined it just checks if the object is instance of Error.
113112
114113
## Authors
115114
* **Simone Primarosa** - [simonepri](https://github.com/simonepri)

index.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,10 @@ function throwError(type, msg, errno, ...debug) {
3737
* @returns {boolean} true if the type match, false otherwise
3838
*/
3939
function errorThrown(err, type) {
40-
if (type !== undefined) {
41-
if (errorExist(type)) {
42-
return err instanceof errors[type];
43-
}
44-
return false;
40+
if (errorExist(type)) {
41+
return err instanceof errors[type];
4542
}
46-
return err instanceof Error;
43+
return false;
4744
}
4845

4946
module.exports = {

0 commit comments

Comments
 (0)