lib/soaspec/o_auth2.rb in soaspec-0.2.29 vs lib/soaspec/o_auth2.rb in soaspec-0.2.30

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + require 'erb' module Soaspec # Handles working with OAuth2 class OAuth2 @@ -96,15 +98,15 @@ # @return [Hash] Hash containing access token parameters def response Soaspec::SpecLogger.info "using oauth_params: #{params}" if debug_oauth? response = RestClient.post(params[:token_url], payload, cache_control: 'no_cache', verify_ssl: false) - rescue RestClient::Exception => error - Soaspec::SpecLogger.info(["oauth_error: #{error.message}", "oauth_response: #{error.response}"]) + rescue RestClient::Exception => e + Soaspec::SpecLogger.info(["oauth_error: #{e.message}", "oauth_response: #{e.response}"]) self.retry_count += 1 sleep 0.1 # Wait if a bit before retying obtaining access token retry if retry_count < self.class.retry_limit - raise error + raise e else Soaspec::SpecLogger.info(["response: \n headers: #{response&.headers}\n body: #{response}\n"]) if debug_oauth? JSON.parse(response) end