Skip to content

Conversation

@MSSedusch
Copy link

Improvements:

  • add another rescue case to catch all errors and log them
  • add correlation id to logs to be able to map put_block, create_block and delete_block operations

rescue Azure::Core::Http::HTTPError => ex
Fog::Logger.warning "Azure error #{e.inspect}, correlation id: #{correlation_id}."
raise_azure_exception(ex, msg)
rescue => e

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/RescueStandardError: Avoid rescuing without specifying an error class.

my_options[:request_id] = SecureRandom.uuid

correlation_id = SecureRandom.uuid
if my_options[:fog_correlation_id] != nil

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/NonNilCheck: Prefer !expression.nil? over expression != nil.

my_options = options.clone

correlation_id = SecureRandom.uuid
if my_options[:fog_correlation_id] != nil

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/NonNilCheck: Prefer !expression.nil? over expression != nil.

return true if ex.message.include?('(404)')
Fog::Logger.warning "Azure error #{e.inspect}, correlation id: #{correlation_id}."
raise_azure_exception(ex, msg)
rescue => e

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/RescueStandardError: Avoid rescuing without specifying an error class.

msg = "Deleting blob: #{blob_name} in container #{container_name}. options: #{my_options}"

correlation_id = SecureRandom.uuid
if my_options[:fog_correlation_id] != nil

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/NonNilCheck: Prefer !expression.nil? over expression != nil.

rescue Azure::Core::Http::HTTPError => ex
Fog::Logger.warning "Azure error #{e.inspect}, correlation id: #{correlation_id}."
raise_azure_exception(ex, msg)
rescue => e

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/RescueStandardError: Avoid rescuing without specifying an error class.

my_options[:request_id] = SecureRandom.uuid

correlation_id = SecureRandom.uuid
if my_options[:fog_correlation_id] != nil

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/NonNilCheck: Prefer !expression.nil? over expression != nil.

rescue Azure::Core::Http::HTTPError => ex
Fog::Logger.warning "Azure error #{e.inspect}, correlation id: #{correlation_id}."
raise_azure_exception(ex, msg)
rescue => e

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/RescueStandardError: Avoid rescuing without specifying an error class.

msg = "commit_blob_blocks: Complete uploading #{blob_name} to the container #{container_name}. options: #{my_options}"

correlation_id = SecureRandom.uuid
if my_options[:fog_correlation_id] != nil

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/NonNilCheck: Prefer !expression.nil? over expression != nil.

my_options = options.clone
my_options[:request_id] = SecureRandom.uuid
msg = "commit_blob_blocks: Complete uploading #{blob_name} to the container #{container_name}. options: #{my_options}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/TrailingWhitespace: Trailing whitespace detected.

my_options[:request_id] = SecureRandom.uuid

correlation_id = SecureRandom.uuid
if !my_options[:fog_correlation_id].nil?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/NegatedIf: Favor unless over if for negative conditions.

msg = "Deleting blob: #{blob_name} in container #{container_name}. options: #{my_options}"

correlation_id = SecureRandom.uuid
if !my_options[:fog_correlation_id].nil?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/NegatedIf: Favor unless over if for negative conditions.

my_options[:request_id] = SecureRandom.uuid

correlation_id = SecureRandom.uuid
if !my_options[:fog_correlation_id].nil?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/NegatedIf: Favor unless over if for negative conditions.

msg = "commit_blob_blocks: Complete uploading #{blob_name} to the container #{container_name}. options: #{my_options}"

correlation_id = SecureRandom.uuid
if !my_options[:fog_correlation_id].nil?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/NegatedIf: Favor unless over if for negative conditions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants