-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We currently decorate plain Error objects. TypeScript doesn’t like this. We better use custom error types.
- Loading branch information
1 parent
f4831a2
commit a5e4b98
Showing
4 changed files
with
22 additions
and
13 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,8 +1,5 @@ | ||
class InconsistentResponseError extends Error { | ||
constructor(message) { | ||
super(message) | ||
this.name = 'InconsistentResponseError' | ||
} | ||
name = 'InconsistentResponseError' | ||
} | ||
|
||
module.exports = InconsistentResponseError |
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,7 @@ | ||
class PollingTimeoutError extends Error { | ||
name = 'PollingTimeoutError' | ||
|
||
code = 'POLLING_TIMED_OUT' | ||
} | ||
|
||
module.exports = PollingTimeoutError |
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,10 @@ | ||
class TransloaditError extends Error { | ||
name = 'TransloaditError' | ||
|
||
constructor(message, body) { | ||
super(message) | ||
this.response = { body } | ||
} | ||
} | ||
|
||
module.exports = TransloaditError |