Created
July 6, 2015 14:45
-
-
Save lourd/773c0a687e7acb0a8b86 to your computer and use it in GitHub Desktop.
ES6 Inheriting Errors
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
// 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