Skip to content

Commit

Permalink
Merge pull request #14832 from eduardoj/fix/rubocop_lint_shadowed_exc…
Browse files Browse the repository at this point in the history
…eption

Address Lint/ShadowedException RuboCop offenses
  • Loading branch information
krauselukas committed Aug 25, 2023
2 parents c6a382b + 78dfb4c commit c4705a0
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 9 deletions.
5 changes: 0 additions & 5 deletions src/api/.rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,6 @@ Lint/RescueException:
- 'config/environment.rb'
- 'lib/tasks/extract.rake'

# Offense count: 1
Lint/ShadowedException:
Exclude:
- 'app/models/project/remote_url.rb'

# Offense count: 1
Lint/StructNewOverride:
Exclude:
Expand Down
4 changes: 1 addition & 3 deletions src/api/app/lib/backend/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,9 @@ def self.put_or_post(method, path, data, in_headers)
end
begin
http.request(backend_request)
# rubocop:disable Lint/ShadowedException
rescue Errno::EPIPE, Errno::ECONNRESET, SocketError, Errno::EINTR, EOFError, IOError, Errno::ETIMEDOUT
rescue Errno::EPIPE, Errno::ECONNRESET, SocketError, Errno::EINTR, IOError, Errno::ETIMEDOUT
raise Timeout::Error
end
# rubocop:enable Lint/ShadowedException
end
Backend::Logger.info(method, host, port, path, response, start_time)
handle_response(response)
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/models/project/remote_url.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def self.load(remote_project, path)
ENV['no_proxy'] = Configuration.first.no_proxy if ENV['no_proxy'].blank?
begin
uri.open.read
rescue OpenURI::HTTPError, SocketError, Errno::EINTR, Errno::EPIPE, EOFError, Net::HTTPBadResponse, IOError, Errno::ENETUNREACH,
rescue OpenURI::HTTPError, SocketError, Errno::EINTR, Errno::EPIPE, Net::HTTPBadResponse, IOError, Errno::ENETUNREACH,
Errno::EADDRNOTAVAIL, Errno::ETIMEDOUT, Errno::ECONNREFUSED, Timeout::Error, OpenSSL::SSL::SSLError => e
Rails.logger.info "#{e} when fetching #{path} from #{remote_project.remoteurl}"
Airbrake.notify(e)
Expand Down

0 comments on commit c4705a0

Please sign in to comment.