-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(errors): tsc needs static errors
- Loading branch information
Showing
1 changed file
with
20 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,20 @@ | ||
module.exports = {}; | ||
|
||
const errorNames = [ | ||
'BadRequestError', | ||
'HTTPError', | ||
'FailedYahooValidationError', | ||
'InvalidOptionsError' | ||
]; | ||
|
||
errorNames.forEach(name => { | ||
// Support for the experimental syntax 'classProperties' isn't currently enabled (node 12.0.0) | ||
module.exports[name] = class extends Error {}; | ||
module.exports[name].name = name; | ||
}); | ||
// Support for the experimental syntax 'classProperties' isn't currently enabled (node 12.0.0) | ||
|
||
class BadRequestError extends Error {} | ||
BadRequestError.name = 'BadRequestError'; | ||
|
||
class HTTPError extends Error {} | ||
HTTPError.name = 'HTTPError'; | ||
|
||
class FailedYahooValidationError extends Error {} | ||
FailedYahooValidationError.name = 'FailedYahooValidationError'; | ||
|
||
class InvalidOptionsError extends Error {} | ||
InvalidOptionsError.name = 'InvalidOptionsError'; | ||
|
||
module.exports = { | ||
BadRequestError, | ||
HTTPError, | ||
FailedYahooValidationError, | ||
InvalidOptionsError, | ||
}; |