Open
Description
It seems clear that this package is intended to catch Error
exceptions. However, catchException
does this:
try {
return t();
} catch (e) {
if (e instanceof Error || Object.prototype.toString.call(e) === "[object Error]") {
return c(e)();
} else {
return c(new Error(e.toString()))();
}
}
That is, if the exception is determined to not be an Error
exception, it attempts to convert the exception to an Error
exception. This conversion itself throws for both null
and undefined
, which are possible values. Furthermore, this implementation prevents users from catching other types of exceptions in an obvious way (they would have to use a different catch before this one).
Suggestion: just rethrow the exception if it is not Error
.