node-jenkins-api icon indicating copy to clipboard operation
node-jenkins-api copied to clipboard

JSON.parse occasionally fails

Open jamesjenner opened this issue 9 years ago • 0 comments

I occasionally get an exception which appears to be caused by the JSON.parse logic in each get request. I don't know the exact situation on which it occurs, but the test for error or a statusCode of 200 isn't covering the problem I get. Sometimes the error states

 Unexpected token <

Other times the error states

Unexpected end of input

For now I've just put a try catch around

In my scenario I'm polling Jenkins every minute and the error generally happens overnight.

I could capture some further information if you would like.

jamesjenner avatar Jun 18 '15 23:06 jamesjenner