Skip to content

Commit

Permalink
Token 401 errors (#546)
Browse files Browse the repository at this point in the history
* TokenEpired and TokenInvalid 401 error raising
  • Loading branch information
kitebuggy committed Sep 27, 2021
1 parent b78a9a0 commit c31755d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ pkg/
.idea/
Gemfile.lock
tmp/
*~ # emacs backup files
*~
TAGS
7 changes: 5 additions & 2 deletions lib/xeroizer/http_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,11 @@ def raise_error!
when 400
raise Xeroizer::BadResponse.new(description)
when 401
raise OAuth::TokenExpired.new(description) if description.include?("TokenExpired")
raise OAuth::TokenInvalid.new(description)
if description.include?("TokenExpired")
raise OAuth::TokenExpired.new(description)
else
raise OAuth::TokenInvalid.new(description)
end
when 403
message = "Possible xero-tenant-id header issue. Xero Error: #{description}"
raise OAuth::Forbidden.new(message)
Expand Down

0 comments on commit c31755d

Please sign in to comment.