Skip to content

Instantly share code, notes, and snippets.

@andreasvirkus
Created May 9, 2017 12:00
Show Gist options
  • Save andreasvirkus/7fddc1e8161e275990a6df90f1991263 to your computer and use it in GitHub Desktop.
Save andreasvirkus/7fddc1e8161e275990a6df90f1991263 to your computer and use it in GitHub Desktop.
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);
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