Skip to content
This repository was archived by the owner on Jan 17, 2025. It is now read-only.

Commit 037dc73

Browse files
Jason Petersoncsantanapr
authored andcommitted
prevent type error exception when 429s are thrown (#3)
1 parent 62fba57 commit 037dc73

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,9 @@ module.exports = class TokenManager {
169169
error.statusCode = resp.statusCode // the http status code
170170
error.error = resp.body // the error body
171171
error.options = options
172-
error.error.error = error.error.errorMessage
172+
if (typeof error.error === 'object') {
173+
error.error.error = error.error.errorMessage
174+
}
173175
return Promise.reject(error)
174176
} else {
175177
// otherwise, the response body is the expected return value

0 commit comments

Comments
 (0)