Skip to content

Instantly share code, notes, and snippets.

@treshugart
Created November 10, 2017 13:18
Show Gist options
  • Save treshugart/9aaf5f710df3eeaa9cb760eb68576d98 to your computer and use it in GitHub Desktop.
Save treshugart/9aaf5f710df3eeaa9cb760eb68576d98 to your computer and use it in GitHub Desktop.
function wrap(func) {
return function(value) {
try {
return func(value);
} catch (e) {
console.error(e);
throw new Error(e);
}
};
}
global.Promise = class extends Promise {
then(pass, fail) {
return super.then(wrap(pass), wrap(fail));
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment