node-oauth
node-oauth copied to clipboard
Errors aren't Errors
There are two open pull requests for this: https://github.com/ciaranj/node-oauth/pull/84 and https://github.com/ciaranj/node-oauth/pull/155
I've ended up working around this like so:
handleError = (err, next)->
# https://github.com/ciaranj/node-oauth/issues/250
if typeof err is "object" and not (err instanceof Error)
error = new Error JSON.stringify err
error[k] = v for k, v of err
try error[k] = v for k, v of qs.parse err.data
next error
else
next err
I have written a module that acts as a solution for this problem called node-oauth-error. It essentially takes in the error objects from oauth and converts them into actual Error objects.
+1