Skip to content

Instantly share code, notes, and snippets.

@MrHen
Created October 20, 2017 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MrHen/c33bac4579330268168fd0a2ddcbfdfc to your computer and use it in GitHub Desktop.
Save MrHen/c33bac4579330268168fd0a2ddcbfdfc to your computer and use it in GitHub Desktop.
Unerror
function unerror (value) {
if (value instanceof Error) {
var error = {}
Object.getOwnPropertyNames(value).forEach(function (key) {
error[key] = value[key]
})
return error
}
return value
}
module.exports = unerror
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment