Closed hlfshell closed 9 years ago
Thank you for your feedback. Indeed when the device is busy it will return the http error code 500. I fixed it by retrying the request for a certain amount of time before throwing an error as before.
You can edit retry settings if needed.
var GoPro = require('./goproh4');
GoPro.maxRetries = 20; //maximum retries
GoPro.retryTimeout = 100; //time between retries
...
Sounds good. Of note is that the 500 error was returning "null" on the catch() function, so perhaps if it fails out it needs to ensure that a real error is passed.
I was attempting to run cam.listMedia() shortly after stopping a recording - this would result in an unhandled rejection. If the .catch() promise was handled, the error was simple "null".
After experimenting I found it had to do with timing - a simple half second delay (maybe even less?) after the cam.stop() would allow the listMedia() to fire off fine - doing listMedia() immediately after a stop() causes an error.
It might be worth noting this in the docs or introducing your own internal rate limiting.