Skip to content

Commit

Permalink
refacto
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Dalous committed Jul 23, 2024
1 parent fbebb48 commit 53de2fa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/algolia/error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ class AlgoliaUnreachableHostError < AlgoliaError
attr_reader :errors

def initialize(message, errors = [])
errors.last&.tap do |last_error|
message += " Last error for #{last_error[:host]}: #{last_error[:error]}"
end
super(message)
@errors = errors
end
Expand Down
2 changes: 1 addition & 1 deletion lib/algolia/transport/transport.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def request(call_type, method, path, body = {}, opts = {})
end
end

raise AlgoliaUnreachableHostError.new("Unreachable hosts. Last error for #{retry_errors.last[:host]}: #{retry_errors.last[:error]}", retry_errors)
raise AlgoliaUnreachableHostError.new("Unreachable hosts.", retry_errors)
end

private
Expand Down

0 comments on commit 53de2fa

Please sign in to comment.