Skip to content

Commit 1441720

Browse files
committed
version 3.2.3
1 parent 879f701 commit 1441720

File tree

5 files changed

+20
-3
lines changed

5 files changed

+20
-3
lines changed

.rubocop.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ AllCops:
77
SuggestExtensions: false
88
Metrics/BlockLength:
99
Max: 100
10+
Metrics/MethodLength:
11+
Max: 50
1012
Layout/LineLength:
1113
Max: 120
1214
Style/Documentation:

CHANGES.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
3.2.3 - Mon Feb 6 2025
2+
===============================================================
3+
- Treat some connection or SSL errors as timeout since the action
4+
to take is the same: try the same request again
5+
16
3.2.2 - Mon Feb 3 2025
27
===============================================================
38
- feature: user-agent string can be set now

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
opencage-geocoder (3.2.2)
4+
opencage-geocoder (3.2.3)
55

66
GEM
77
remote: https://rubygems.org/

lib/opencage/geocoder.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,17 @@ def initialize(default_options = {})
1515
def geocode(location, options = {})
1616
request = Request.new(@api_key, location, options)
1717

18-
results = fetch(request.to_s)
18+
begin
19+
results = fetch(request.to_s)
20+
rescue Errno::ECONNREFUSED
21+
raise_error("408 Failed to open TCP connection to API #{request}")
22+
rescue Errno::ECONNRESET
23+
# Connection reset by peer - SSL_connect
24+
raise_error("408 Failed to open SSL connection to API #{request}")
25+
rescue Net::OpenTimeout
26+
raise_error("408 Timeout connecting to API #{request}")
27+
end
28+
1929
return [] unless results
2030

2131
results.map { |r| Location.new(r) }

lib/opencage/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module OpenCage
2-
VERSION = '3.2.2'.freeze
2+
VERSION = '3.2.3'.freeze
33
end

0 commit comments

Comments
 (0)