duosecurity / duo_api_nodejs

Other
20 stars 20 forks source link

Error handling added #20

Closed driverjb closed 5 years ago

driverjb commented 5 years ago

In the event of a timeout or other non 200 http code response the request error will now be caught and formatted similarly to the response block ( { stat: 'OK', ...} ) and returned through the callback.

I have tested this code in our system and it does properly handle timeouts. A caught error will look like this:

{
  stat: 'ERROR',
  message: 'Some error message taken from the caught Error object'
}

This fix will take care of issue #19