nodejitsu/pkgcloud — pull request #140 by kenperkins (2013-05-17 15:19:28+00:00)
Title: [Rackspace] return a proper error if unauthorized

This Pull Request fixes #114, a long standing issue where the client didn't properly return an unauthorized error when given bad credentials.

Mostly this affected developer time changes, but it's conceivable that you could have your apiKey changed and all your tooling would start breaking in wierd ways as the authorization wouldn't do what you expect.

As part of this change, I've created a new `defaultRequestHandler` on the base `client` that takes a callback and returns the standard callback function with global error handling. This way, clients that use `request` proper for authentication can still leverage the standard error handling in the base client.