lib/xero_gateway/oauth.rb in xero_gateway-2.0.16 vs lib/xero_gateway/oauth.rb in xero_gateway-2.0.17
- old
+ new
@@ -68,9 +68,14 @@
:oauth_session_handle => session_handle,
:token => old_token
})
update_attributes_from_token(access_token)
+ rescue OAuth::Unauthorized => e
+ # If the original access token is for some reason invalid an OAuth::Unauthorized could be raised.
+ # In this case raise a XeroGateway::OAuth::TokenInvalid which can be captured by the caller. In this
+ # situation the end user will need to re-authorize the application via the request token authorization URL
+ raise XeroGateway::OAuth::TokenInvalid.new(e.message)
end
private
# Update instance variables with those from the AccessToken.