diff --git a/lib/instapaper/api/oauth.rb b/lib/instapaper/api/oauth.rb index 3c74940..52a0022 100644 --- a/lib/instapaper/api/oauth.rb +++ b/lib/instapaper/api/oauth.rb @@ -9,7 +9,7 @@ module Instapaper def access_token(username, password) response = perform_post_with_unparsed_response('/api/1.1/oauth/access_token', x_auth_username: username, x_auth_password: password, x_auth_mode: 'client_auth') parsed_response = QLineParser.parse(response) - fail Instapaper::Error::OAuthError, parsed_response['error'] if parsed_response.key?('error') + raise Instapaper::Error::OAuthError, parsed_response['error'] if parsed_response.key?('error') Instapaper::Credentials.new(parsed_response) end end diff --git a/lib/instapaper/http/response.rb b/lib/instapaper/http/response.rb index 0947a83..15da2a5 100644 --- a/lib/instapaper/http/response.rb +++ b/lib/instapaper/http/response.rb @@ -39,9 +39,9 @@ module Instapaper return if response.status.ok? if Instapaper::Error::CODES.include?(response.status.code) - fail Instapaper::Error.from_response(response.status.code, path) + raise Instapaper::Error.from_response(response.status.code, path) else - fail Instapaper::Error, 'Unknown Error' + raise Instapaper::Error, 'Unknown Error' end end @@ -53,10 +53,10 @@ module Instapaper def fail_if_body_contains_error return unless parsed.is_a?(Array) - return unless parsed.size > 0 + return if parsed.empty? return unless parsed.first['type'] == 'error' - fail Instapaper::Error.from_response(parsed.first['error_code'], @path) + raise Instapaper::Error.from_response(parsed.first['error_code'], @path) end end end