Skip to content

Commit 5bd2870

Browse files
author
Thomas Dalous
committed
chore: refacto
1 parent d91ecc8 commit 5bd2870

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

clients/algoliasearch-client-ruby/lib/algolia/error.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ class AlgoliaUnreachableHostError < AlgoliaError
1313
attr_reader :errors
1414

1515
def initialize(message, errors = [])
16+
errors.last&.tap do |last_error|
17+
message += " Last error for #{last_error[:host]}: #{last_error[:error]}"
18+
end
1619
super(message)
1720
@errors = errors
1821
end

clients/algoliasearch-client-ruby/lib/algolia/transport/transport.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def request(call_type, method, path, body, opts = {})
8080
end
8181
end
8282

83-
raise Algolia::AlgoliaUnreachableHostError.new("Unreachable hosts. Last error for #{retry_errors.last[:host]}: #{retry_errors.last[:error]}", retry_errors)
83+
raise Algolia::AlgoliaUnreachableHostError.new("Unreachable hosts.", retry_errors)
8484
end
8585

8686
private

0 commit comments

Comments
 (0)