Skip to content

Instantly share code, notes, and snippets.

@tetchel
Last active February 26, 2019 18:10
Show Gist options
  • Save tetchel/237cb4dfe8fab6a09b9185519708e126 to your computer and use it in GitHub Desktop.
Save tetchel/237cb4dfe8fab6a09b9185519708e126 to your computer and use it in GitHub Desktop.
> const err = new Error("oh no")
undefined
> err
Error: oh no
at repl:1:13
at Script.runInThisContext (vm.js:96:20)
at REPLServer.defaultEval (repl.js:329:29)
at bound (domain.js:396:14)
at REPLServer.runBound [as eval] (domain.js:409:12)
at REPLServer.onLine (repl.js:642:10)
at REPLServer.emit (events.js:187:15)
at REPLServer.EventEmitter.emit (domain.js:442:20)
at REPLServer.Interface._onLine (readline.js:290:10)
at REPLServer.Interface._line (readline.js:638:8)
> err.toString()
'Error: oh no'
> JSON.stringify(err)
'{}'
> err instanceof Object
true
> err instanceof Error
true
> const util = require("util")
undefined
> util.inspect(err)
'Error: oh no\n at repl:1:13\n at Script.runInThisContext (vm.js:96:20)\n at REPLServer.defaultEval (repl.js:329:29)\n at bound (domain.js:396:14)\n at REPLServer.runBound [as eval] (domain.js:409:12)\n at REPLServer.onLine (repl.js:642:10)\n at REPLServer.emit (events.js:187:15)\n at REPLServer.EventEmitter.emit (domain.js:442:20)\n at REPLServer.Interface._onLine (readline.js:290:10)\n at REPLServer.Interface._line (readline.js:638:8)'
> err.message
'oh no'
> err.stack
'Error: oh no\n at repl:1:13\n at Script.runInThisContext (vm.js:96:20)\n at REPLServer.defaultEval (repl.js:329:29)\n at bound (domain.js:396:14)\n at REPLServer.runBound [as eval] (domain.js:409:12)\n at REPLServer.onLine (repl.js:642:10)\n at REPLServer.emit (events.js:187:15)\n at REPLServer.EventEmitter.emit (domain.js:442:20)\n at REPLServer.Interface._onLine (readline.js:290:10)\n at REPLServer.Interface._line (readline.js:638:8)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment