Closed danprince closed 7 years ago
haha np! yea I've wanted this myself. guess the hack could be here
https://github.com/brianleroux/tiny-json-http/blob/master/_write.js#L40
var err = Error(httpMethod + ' failed with: ' + res.statusCode)
err.raw = Buffer.concat(raw).toString()
callback(err)
fixed in 5.2 thx to @danprince 🔥 🔥 🔥
Sorry! You can't get rid of me today, I'm afraid.
I'm trying to implement some logic for retrying requests after Slack imposes a rate limit, where they respond with a
429
and send aRetry-After
header.The errors I'm catching are regular error objects with the message:
"POST failed with: 429"
and no additional context.Ideally,
tiny-json-http
would expose the underlying HTTP response on the error property so that we could get at the headers and status code directly.