Created
May 9, 2017 12:00
-
-
Save andreasvirkus/7fddc1e8161e275990a6df90f1991263 to your computer and use it in GitHub Desktop.
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
module.exports = function DefaultError(message, extra) { | |
Error.captureStackTrace(this, this.constructor); | |
this.name = this.constructor.name; | |
this.message = message; | |
this.extra = extra; | |
}; | |
require('util').inherits(module.exports, Error); |
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
import DefaultError from '../errors/DefaultError'; | |
import axios from 'axios'; | |
axios.get('/some/url') | |
.then(payload => { | |
// pay the piper | |
}) | |
.catch(err => { | |
throw new DefaultError('Failed to refresh an access token', err); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment