Closed mcollina closed 8 years ago
you mean the Error
constructor?
They're a bit awkward though
JSON.stringify(Error('foo')) // {}
You'd have to do
var err = Error()
err.message = 'foo'
JSON.stringify(err) // {"message": "foo"}
Agreed the approach should be consistent, maybe a little mu-error module or something that keeps error generation consistent?
Yes. We need to do something like https://www.npmjs.com/package/boom.
I’m having a problem with this - the err and res seems to get screwed up when there is an err (of type Error): e.g. Wiring error: Error: not found Wiring result: undefined
Client error: {} Client result: { err: {} }
And if I return a string 'not found' as the err, I get:
Client error: not found Client result: { err: 'not found' }
When I was really expecting an empty (undefined) result
as titled, in several places are strings or objects