-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from mattolson/error-handling
v2.0.0: Update error handling
- Loading branch information
Showing
9 changed files
with
264 additions
and
230 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
'use strict'; | ||
|
||
class AppError extends Error { | ||
constructor(message, details) { | ||
// Calling parent constructor of base Error class. | ||
super(message); | ||
|
||
// Saving class name in the property of our custom error as a shortcut. | ||
this.name = this.constructor.name; | ||
|
||
// Capturing stack trace, excluding constructor call from it. | ||
Error.captureStackTrace(this, this.constructor); | ||
|
||
// Store extra details for caller to diagnose error | ||
this.details = details || {}; | ||
} | ||
}; | ||
|
||
module.exports = AppError; |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.