Open Rigaudon opened 8 years ago
Hey, thanks, I've actually haven't been able to test that case, since I haven't seen that error happen. I copied those error checks from the web's javascript.
Have you actually seen that error with the format {"status":"error","message":"{scan-throttle}"}
?
I'm changing the error handling to cover better that cases.
Yeah, I've been trying to use your api and calling pokegoScan in a function several times. I believe the rate limit is once every 30 seconds? In any case, when I get rate limited, instead of telling me that I was sending too many requests, it was caught by the generic error "Unable to scan for pokemon.."
As is, in the try block in createScanJob, parsing a json that has a status of "error" with a message of (for example) "{scan-throttle}" will not be caught, but instead passed as that json object to next().
In other words, if a user gets a scan-throttle error, then in this function, it will successfully parse the json in the try block as {"status":"error","message":"{scan-throttle}"} and call next with a null err, which is not the intended behavior. It should be caught in the block after the try.