TritonDataCenter / node-verror

Rich JavaScript errors
MIT License
1.18k stars 61 forks source link

make it easy to find causes of a particular kind #11

Closed davepacheco closed 8 years ago

davepacheco commented 10 years ago

It would be nice to have cause() take a "name" argument that walks the chain of causes until it finds one with the given name. That way you could do something like:

someHttpError.cause('SocketError')

Otherwise, people might end up depending on the exact cause chain (e.g., an HTTP error, then a socket error), which might break if a layer in between adds a useful intermediate message.

CC @jclulow @tjfontaine

davepacheco commented 8 years ago

I've prototyped this in my branch for #10. See my comments there.

davepacheco commented 8 years ago

This has finally landed. I'll be publishing v1.7.0 with this change.