Closed seanrose closed 10 years ago
Yeah, I was going to refactor that stuff a bit. How do you think the rate-limiting stuff should be exposed externally? Maybe an options
arg to all methods?
Digging a bit deeper... right now, all 429 errors are just exposed as an error object, and rate-limiting must be handled manually. The 202 w/ retry-after used in session/thumbnail/content calls is not necessarily rate-limiting per se, but actually just the API saying "wait, I'm still processing". So I think it's fundamentally different in that sense.
Would it be good to have some kind of optional rate limiting helper built into
createDefaultResponseHandler
with similar to https://github.com/lakenen/node-box-view/blob/master/index.js#L338 (since rate limiting can occur on any method)?