Skip to content

Commit

Permalink
slack api - extend error object with response details if rate limit
Browse files Browse the repository at this point in the history
  • Loading branch information
ihorrusinko committed Jan 30, 2019
1 parent b142e13 commit 623b1b0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/Slack_web_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,9 @@ module.exports = function(bot, config) {

return cb((json.ok ? null : json.error), json);
} else if (response.statusCode == 429) {
return cb(new Error('Rate limit exceeded'));
var rateLimitError = new Error('Rate limit exceeded');
rateLimitError.response = response;
return cb(rateLimitError);
} else {
return cb(new Error('Invalid response'));
}
Expand Down

0 comments on commit 623b1b0

Please sign in to comment.