code-ruby 3.0.7 → 3.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/VERSION +1 -1
- data/lib/code/object/http.rb +1 -1
- data/lib/code/parser.rb +31 -31
- data/spec/code/object/http_spec.rb +13 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 68690c629fa2b9efc377f2c37df52fbd9bc43bdadeb25f4584ab1dade66bd31b
|
|
4
|
+
data.tar.gz: 45bc52004038294c5a64f60af00fa8be25e0e8776e5197f0e16e3d5360081159
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3f7fd27f0fa003a92979076a66b10470dc3d63cf4752c04c920a5ba603c1cc21ce3b03ab85e53632b130f1da4bad878ffa4f1c63f66429bae71830bb36fc4724
|
|
7
|
+
data.tar.gz: bfff6eaea1b0c30e1a1247c3266f116e58b2c41757cf40305b1451340f06c9aec4de69acaa8e2f2dd865d202860d641414306243eeb402dad8107f8b51c57492
|
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.0.
|
|
1
|
+
3.0.8
|
data/lib/code/object/http.rb
CHANGED
|
@@ -226,7 +226,7 @@ class Code
|
|
|
226
226
|
response = http.request(request)
|
|
227
227
|
rescue ::Timeout::Error, ::Errno::ETIMEDOUT
|
|
228
228
|
raise ::Code::Error, "http timeout"
|
|
229
|
-
rescue OpenSSL::SSL::SSLError, IOError, SystemCallError
|
|
229
|
+
rescue OpenSSL::SSL::SSLError, IOError, SystemCallError, SocketError
|
|
230
230
|
raise ::Code::Error, "http error"
|
|
231
231
|
end
|
|
232
232
|
|
data/lib/code/parser.rb
CHANGED
|
@@ -32,37 +32,37 @@ class Code
|
|
|
32
32
|
while
|
|
33
33
|
].freeze
|
|
34
34
|
|
|
35
|
-
MULTI_CHAR_OPERATORS =
|
|
36
|
-
&.
|
|
37
|
-
&&
|
|
38
|
-
&&=
|
|
39
|
-
**
|
|
40
|
-
*=
|
|
41
|
-
+=
|
|
42
|
-
-=
|
|
43
|
-
..
|
|
44
|
-
...
|
|
45
|
-
/=
|
|
46
|
-
::
|
|
47
|
-
<<=
|
|
48
|
-
<<
|
|
49
|
-
<=>
|
|
50
|
-
<=
|
|
51
|
-
===
|
|
52
|
-
==
|
|
53
|
-
=~
|
|
54
|
-
>=
|
|
55
|
-
>>=
|
|
56
|
-
>>
|
|
57
|
-
||=
|
|
58
|
-
||
|
|
59
|
-
|=
|
|
60
|
-
!==
|
|
61
|
-
!=
|
|
62
|
-
!~
|
|
63
|
-
%=
|
|
64
|
-
^=
|
|
65
|
-
=>
|
|
35
|
+
MULTI_CHAR_OPERATORS = [
|
|
36
|
+
"&.",
|
|
37
|
+
"&&",
|
|
38
|
+
"&&=",
|
|
39
|
+
"**",
|
|
40
|
+
"*=",
|
|
41
|
+
"+=",
|
|
42
|
+
"-=",
|
|
43
|
+
"..",
|
|
44
|
+
"...",
|
|
45
|
+
"/=",
|
|
46
|
+
"::",
|
|
47
|
+
"<<=",
|
|
48
|
+
"<<",
|
|
49
|
+
"<=>",
|
|
50
|
+
"<=",
|
|
51
|
+
"===",
|
|
52
|
+
"==",
|
|
53
|
+
"=~",
|
|
54
|
+
">=",
|
|
55
|
+
">>=",
|
|
56
|
+
">>",
|
|
57
|
+
"||=",
|
|
58
|
+
"||",
|
|
59
|
+
"|=",
|
|
60
|
+
"!==",
|
|
61
|
+
"!=",
|
|
62
|
+
"!~",
|
|
63
|
+
"%=",
|
|
64
|
+
"^=",
|
|
65
|
+
"=>"
|
|
66
66
|
].sort_by(&:length).reverse.freeze
|
|
67
67
|
CONTINUATION_KEYWORDS = %w[or and rescue].freeze
|
|
68
68
|
POSTFIX_CONTINUATIONS = %w[. :: &.].freeze
|
|
@@ -16,5 +16,18 @@ RSpec.describe Code::Object::Http do
|
|
|
16
16
|
)
|
|
17
17
|
end.to raise_error(Code::Error, "http error")
|
|
18
18
|
end
|
|
19
|
+
|
|
20
|
+
it "wraps name resolution errors as Code::Error" do
|
|
21
|
+
allow_any_instance_of(Net::HTTP).to receive(:request).and_raise(
|
|
22
|
+
Socket::ResolutionError,
|
|
23
|
+
"getaddrinfo(3): Temporary failure in name resolution"
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
expect do
|
|
27
|
+
described_class.code_get(
|
|
28
|
+
Code::Object::String.new("https://api.github.com")
|
|
29
|
+
)
|
|
30
|
+
end.to raise_error(Code::Error, "http error")
|
|
31
|
+
end
|
|
19
32
|
end
|
|
20
33
|
end
|