Skip to content

Instantly share code, notes, and snippets.

@lourd
Created July 6, 2015 14:45
Show Gist options
  • Save lourd/773c0a687e7acb0a8b86 to your computer and use it in GitHub Desktop.
Save lourd/773c0a687e7acb0a8b86 to your computer and use it in GitHub Desktop.
ES6 Inheriting Errors
// Making this a global and not exporting because Meteor
BetterError = class extends Error {
constructor(message, details) {
var stack = super().stack;
this.stack = stack;
this.message = message;
if (typeof details === 'object') {
details = JSON.stringify(details);
}
this.details = details;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment