ArkeologeN / node-linkedin

LinkedIn 2.0 wrapper in Node.js
MIT License
163 stars 78 forks source link

Handle LinkedIn errors inside library to pass them as `err` to callback #5

Closed irnc closed 9 years ago

irnc commented 10 years ago

Right now LinkedIn errors are not passed as err to callback.

By LinkedIn error I mean HTTP response with status code not equal to 200 and with response body with errorCode property.

For now only connection level errors are passed as err (this is behaviour inherited from request module).

Are you ok to receive pull request which implement passing LinkedIn errors to callback as err?

ArkeologeN commented 10 years ago

Yeah that's fine. Sound's good. Nice idea. Lets do it!

ArkeologeN commented 10 years ago

But we'll take care if we still throw Error object wrapped up over the status error etc thrown by LinkedIn?

So, it will make something like this:

// If something wrong happened with status & request code is != 200
throw Error('put_linkedIn_error_message_here');