joyent/node-http-signature — pull request #1 by jmar777 (2012-01-31 20:59:23+00:00)
Title: MissingHeaderError instead of TypeError when headers.authorization is missing

I made a small connect middleware wrapper around node-http-signature, and I want to be able to distinguish between programmer errors (e.g., wrong/missing parameters), and a failed attempt to authenticate a request. lib/parser.js consistently uses `TypeError` instances for the former, and some custom error types for the latter. The one exception I noticed is that when request.headers.authorization isn't present, a `TypeError` being thrown, rather than, e.g., a `MissingHeaderError`.

For my purposes, there's a pretty trivial workaround (just inspect the message string), but it's also trivial to address in the library itself, so here's a pull request if you agree :)