Last active
August 16, 2016 15:22
-
-
Save mrister/43154f7081836085c2e667565cf085a7 to your computer and use it in GitHub Desktop.
WError example
This file contains hidden or 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
const VError = require('verror').VError; | |
const WError = require('verror').WError; | |
const errReqFail = new Error('Request failed'); | |
const errReqStatus = new VError(errReqFail, 'Unexpected status code "%s"', '500'); | |
const errReq = new WError(errReqStatus, 'Internal error'); | |
console.error(errReq.message); //Internal error: | |
// get some real data for logging | |
console.info(errReq.toString()); //WError: Internal error; caused by VError: Unexpected status code "500": Request failed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment