You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
raynos at raynos-MacBookPro ~/projects/error on master
$ node
> var Typed = require('./typed')
undefined
> var MyError = Typed({ type: 'foo', message: 'bar' })
undefined
> var e = MyError()
undefined
> e
{ [FooError: bar]
type: 'foo',
message: 'bar',
name: 'FooError',
fullType: 'foo' }
> var MyError = Typed({ type: 'foo' })
AssertionError: TypedError: must specify options.message
at TypedError (/home/raynos/projects/error/typed.js:14:5)
at repl:1:15
at REPLServer.self.eval (repl.js:110:21)
at repl.js:249:20
at REPLServer.self.eval (repl.js:122:7)
at Interface.<anonymous> (repl.js:239:12)
at Interface.emit (events.js:95:17)
at Interface._onLine (readline.js:202:10)
at Interface._line (readline.js:531:8)
at Interface._ttyWrite (readline.js:760:14)
I think your problem is that your creating an error object without a message.
In latest version of require('error') the message field is required and will never be unset.
Upgrade to master and make sure all your typed error classes have a message field.
Using typed error and trying to log the error (or anything which causes toString to be called) results in a fatal 'illegal access' error in 0.10.x
Obviously this isn't something which can be fixed, but it's a hard to debug problem, so a warning in the readme would help here.
The text was updated successfully, but these errors were encountered: