Skip to content

Conversation

Manisha15
Copy link
Contributor

Fixes #108

@Manisha15 Manisha15 force-pushed the fix_error_handling branch from 625d8b9 to 89dd5b5 Compare July 28, 2025 07:19
raise(Fog::Errors::NotFound)
end
rescue StandardError
raise e
Copy link
Contributor

Choose a reason for hiding this comment

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

whats the reason to to just re-raise an exception? is the exception handling then useful?

rescue StandardError => e
if e.respond_to?('response') && e.response.respond_to?('data') && e.response.data.has_key?(:reason_phrase) && e.response.data[:reason_phrase].end_with?('does not exist')
raise(Fog::Errors::NotFound)
if e.respond_to?('response') && e.response.respond_to?('data') && e.response.data.has_key?(:body)
Copy link
Contributor

Choose a reason for hiding this comment

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

handling body additionally, might be useful - but we still should catch the reason_pharse, too?

Copy link

Choose a reason for hiding this comment

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

As I explained in #108, the reason phrase should not be used for anything. It might be overwritten by intermediate servers or completely discarded.

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

Labels

None yet

3 participants