This repository has been archived by the owner on Dec 13, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replacing ID site verification error handler with this, so that we don’t show all the token cruft to the end-user. Instead, just the error message string.
- Loading branch information
Robert
committed
Feb 5, 2016
1 parent
f813dba
commit b9f59fa
Showing
4 changed files
with
29 additions
and
5 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,20 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Use this method to render JSON error responses, for errors that arise from | ||
* the underlying Node SDK | ||
* | ||
* @function | ||
* | ||
* @param {Object} err - An error object, likely from the Node SDK | ||
* @param {Object} res - Express http response | ||
* @param {Object} context - Describe where this error is coming from, for | ||
* a fallback message when the error does not contain a message. | ||
*/ | ||
function defaultJsonErrorResponder(err, res, context) { | ||
return res.status(err.status || 500).json({ | ||
error: err.userMessage || err.message || ('Unexpected error in ' + context) | ||
}); | ||
} | ||
|
||
module.exports = defaultJsonErrorResponder; |
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