Skip to content
Snippets Groups Projects
Commit e1acca6e authored by Shubham Kumar's avatar Shubham Kumar Committed by Rémy Coutable
Browse files

Resolves rubocop offense Style/RescueStandardError

parent ced9a272
No related branches found
No related tags found
No related merge requests found
Showing
with 23 additions and 30 deletions
Loading
Loading
@@ -910,13 +910,6 @@ Style/RedundantSelf:
Style/RescueModifier:
Enabled: false
 
# Offense count: 359
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: implicit, explicit
Style/RescueStandardError:
Enabled: false
# Offense count: 123
# Cop supports --auto-correct.
Style/SingleArgumentDig:
Loading
Loading
Loading
Loading
@@ -97,7 +97,7 @@ def find_or_create_namespace(names, owner)
group = Groups::NestedCreateService.new(current_user, group_path: names).execute
 
group.errors.any? ? current_user.namespace : group
rescue => e
rescue StandardError => e
Gitlab::AppLogger.error(e)
 
current_user.namespace
Loading
Loading
Loading
Loading
@@ -15,7 +15,7 @@ def new
def callback
begin
res = Gitlab::FogbugzImport::Client.new(import_params.to_h.symbolize_keys)
rescue
rescue StandardError
# If the URI is invalid various errors can occur
return redirect_to new_import_fogbugz_path, alert: _('Could not connect to FogBugz, check your URL')
end
Loading
Loading
Loading
Loading
@@ -24,7 +24,7 @@ def verify_qsh_claim!
 
# Make sure `qsh` claim matches the current request
render_403 unless payload['qsh'] == Atlassian::Jwt.create_query_string_hash(request.url, request.method, jira_connect_base_url)
rescue
rescue StandardError
render_403
end
 
Loading
Loading
Loading
Loading
@@ -35,7 +35,7 @@ def archive
return if archive_not_modified?
 
send_git_archive @repository, **repo_params
rescue => ex
rescue StandardError => ex
logger.error("#{self.class.name}: #{ex}")
git_not_found!
end
Loading
Loading
Loading
Loading
@@ -72,7 +72,7 @@ def last_commit(project)
else
'Never'
end
rescue
rescue StandardError
'Never'
end
 
Loading
Loading
Loading
Loading
@@ -228,7 +228,7 @@ def event_note_title_html(event)
def event_commit_title(message)
message ||= ''
(message.split("\n").first || "").truncate(70)
rescue
rescue StandardError
"--broken encoding"
end
 
Loading
Loading
Loading
Loading
@@ -13,7 +13,7 @@ def x509_subject(subject, search_keys)
end
 
subjects
rescue
rescue StandardError
{}
end
 
Loading
Loading
Loading
Loading
@@ -33,7 +33,7 @@ def json_data
@json_data ||= begin
prepare!
Gitlab::Json.parse(blob.data)
rescue
rescue StandardError
{}
end
end
Loading
Loading
Loading
Loading
@@ -330,7 +330,7 @@ def with_preloads
 
begin
build.deployment.drop!
rescue => e
rescue StandardError => e
Gitlab::ErrorTracking.track_and_raise_for_dev_exception(e, build_id: build.id)
end
 
Loading
Loading
Loading
Loading
@@ -29,7 +29,7 @@ def self.bulk_import(artifacts, pick_up_at = nil)
def delete_file_from_storage
file.remove!
true
rescue => exception
rescue StandardError => exception
Gitlab::ErrorTracking.track_exception(exception)
false
end
Loading
Loading
Loading
Loading
@@ -15,13 +15,13 @@ class PersistentRef
 
def exist?
ref_exists?(path)
rescue
rescue StandardError
false
end
 
def create
create_ref(sha, path)
rescue => e
rescue StandardError => e
Gitlab::ErrorTracking
.track_exception(e, pipeline_id: pipeline.id)
end
Loading
Loading
@@ -30,7 +30,7 @@ def delete
delete_refs(path)
rescue Gitlab::Git::Repository::NoRepository
# no-op
rescue => e
rescue StandardError => e
Gitlab::ErrorTracking
.track_exception(e, pipeline_id: pipeline.id)
end
Loading
Loading
Loading
Loading
@@ -53,7 +53,7 @@ def current
return cached_record if cached_record.present?
 
current_without_cache.tap { |current_record| current_record&.cache! }
rescue => e
rescue StandardError => e
if Rails.env.production?
Gitlab::AppLogger.warn("Cached record for #{name} couldn't be loaded, falling back to uncached record: #{e}")
else
Loading
Loading
@@ -66,7 +66,7 @@ def current
def expire
Gitlab::SafeRequestStore.delete(request_store_cache_key)
cache_backend.delete(cache_key)
rescue
rescue StandardError
# Gracefully handle when Redis is not available. For example,
# omnibus may fail here during gitlab:assets:compile.
end
Loading
Loading
Loading
Loading
@@ -17,7 +17,7 @@ module HasRepository
 
def valid_repo?
repository.exists?
rescue
rescue StandardError
errors.add(:base, _('Invalid repository path'))
false
end
Loading
Loading
@@ -25,7 +25,7 @@ def valid_repo?
def repo_exists?
strong_memoize(:repo_exists) do
repository.exists?
rescue
rescue StandardError
false
end
end
Loading
Loading
Loading
Loading
@@ -50,7 +50,7 @@ module RepositoryStorageMovable
 
begin
storage_move.container.set_repository_read_only!(skip_git_transfer_check: true)
rescue => err
rescue StandardError => err
storage_move.add_error(err.message)
next false
end
Loading
Loading
Loading
Loading
@@ -33,7 +33,7 @@ def validate_binary_column_exists!(name)
unless column.type == :binary
raise ArgumentError.new("sha256_attribute #{name.inspect} is invalid since the column type is not :binary")
end
rescue => error
rescue StandardError => error
Gitlab::AppLogger.error "Sha256Attribute initialization: #{error.message}"
raise
end
Loading
Loading
Loading
Loading
@@ -26,7 +26,7 @@ def validate_binary_column_exists!(name)
unless column.type == :binary
raise ArgumentError.new("sha_attribute #{name.inspect} is invalid since the column type is not :binary")
end
rescue => error
rescue StandardError => error
Gitlab::AppLogger.error "ShaAttribute initialization: #{error.message}"
raise
end
Loading
Loading
Loading
Loading
@@ -48,7 +48,7 @@ def move_dir
begin
send_update_instructions
write_projects_repository_config
rescue => e
rescue StandardError => e
Gitlab::ErrorTracking.track_and_raise_for_dev_exception(e,
full_path_before_last_save: full_path_before_last_save,
full_path: full_path,
Loading
Loading
Loading
Loading
@@ -33,7 +33,7 @@ def validate_binary_column_exists!(name)
unless column.type == :binary
raise ArgumentError.new("x509_serial_number_attribute #{name.inspect} is invalid since the column type is not :binary")
end
rescue => error
rescue StandardError => error
Gitlab::AppLogger.error "X509SerialNumberAttribute initialization: #{error.message}"
raise
end
Loading
Loading
Loading
Loading
@@ -94,7 +94,7 @@ def self.create_for_designs(design_actions, sha, author)
 
version
end
rescue
rescue StandardError
raise CouldNotCreateVersion.new(sha, issue_id, design_actions)
end
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment