Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/twitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ Twitter.prototype._doRestApiRequest = function (reqOpts, twitOptions, method, ca
// place the errors in the HTTP response body into the Error object and pass control to caller
var err = helpers.makeTwitError('Twitter API Error')
err.statusCode = response ? response.statusCode: null;
err.headers = response ? response.headers : null;
helpers.attachBodyInfoToError(err, body);
callback(err, body, response);
return
Expand Down
2 changes: 2 additions & 0 deletions tests/rest.js
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ describe('REST API', function () {
assert(err.statusCode === 401)
assert(err.code > 0)
assert(err.message.match(/token/))
assert(typeof err.headers === 'object')
assert(err.twitterReply)
assert(err.allErrors)
assert(res)
Expand All @@ -654,6 +655,7 @@ describe('REST API', function () {
.catch(err => {
assert(err instanceof Error)
assert(err.statusCode === 401)
assert(typeof err.headers === 'object')
assert(err.code > 0)
assert(err.message.match(/token/))
assert(err.twitterReply)
Expand Down