Zfilipin has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/168285

Change subject: Fixed RuboCop offense Style/SignalException
......................................................................

Fixed RuboCop offense Style/SignalException

Bug: 63307
Change-Id: I37905faabe01dd5c49b17dd5bd16c72d75dba456
---
M .rubocop_todo.yml
M lib/mediawiki_api/client.rb
2 files changed, 6 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/ruby/api 
refs/changes/85/168285/1

diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 2458f24..afb98b6 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -41,12 +41,6 @@
 Style/RegexpLiteral:
   MaxSlashes: 0
 
-# Offense count: 6
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles.
-Style/SignalException:
-  Enabled: false
-
 # Offense count: 9
 # Cop supports --auto-correct.
 Style/SpaceInsideParens:
diff --git a/lib/mediawiki_api/client.rb b/lib/mediawiki_api/client.rb
index 44516db..7de96c4 100644
--- a/lib/mediawiki_api/client.rb
+++ b/lib/mediawiki_api/client.rb
@@ -37,10 +37,10 @@
 
       response = @conn.send(method, "", params.merge(action: name, format: 
FORMAT))
 
-      raise HttpError, response.status if response.status >= 400
+      fail HttpError, response.status if response.status >= 400
 
       if response.headers.include?("mediawiki-api-error")
-        raise ApiError, Response.new(response, ["error"])
+        fail ApiError, Response.new(response, ["error"])
       end
 
       Response.new(response, envelope)
@@ -59,7 +59,7 @@
       when "NeedToken"
         data = create_account(username, password, data["token"])
       else
-        raise CreateAccountError, data["result"]
+        fail CreateAccountError, data["result"]
       end
 
       data
@@ -75,7 +75,7 @@
 
     def edit(params = {})
       response = action(:edit, params)
-      raise EditError, response if response.data["result"] == "Failure"
+      fail EditError, response if response.data["result"] == "Failure"
       response
     end
 
@@ -100,7 +100,7 @@
       when "NeedToken"
         data = log_in(username, password, data["token"])
       else
-        raise LoginError, data["result"]
+        fail LoginError, data["result"]
       end
 
       data
@@ -155,7 +155,7 @@
         response = action(:tokens, type: type, http_method: :get, token_type: 
false)
 
         if response.warnings? && response.warnings.grep(/Unrecognized value 
for parameter 'type'/).any?
-          raise TokenError, response.warnings.join(", ")
+          fail TokenError, response.warnings.join(", ")
         end
 
         @tokens[type] = response.data["#{type}token"]

-- 
To view, visit https://gerrit.wikimedia.org/r/168285
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I37905faabe01dd5c49b17dd5bd16c72d75dba456
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/ruby/api
Gerrit-Branch: master
Gerrit-Owner: Zfilipin <zfili...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to