Skip to content

Commit 53de2fa

Browse files
author
Thomas Dalous
committed
refacto
1 parent fbebb48 commit 53de2fa

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

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

lib/algolia/transport/transport.rb

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

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

8888
private

0 commit comments

Comments
 (0)