jess 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/jess.gemspec +1 -1
- data/lib/jess/http_client/error.rb +3 -2
- data/lib/jess/http_client/error_decorator.rb +20 -7
- data/lib/jess/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e985dfaac99aefd361d7d511a07b18fed67601c0ce3c3872720ce87e57fefc4
|
4
|
+
data.tar.gz: f1d3268a4695cb56c7ce6c4aabd9dde74dadd4f3966c26af034832aadc050199
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2e07dacf7bc4fa5fb51253496cede6e3e096e3b52b1c1e1192272cbb29474f1e0ac9c414823c7133b5c0f0ccf3c5b0d5aabb124467c6c8fd6a08552375c2913
|
7
|
+
data.tar.gz: fd55e5b5f8af1f59eff854996f234284089b8084e74e728e786e0ed2b16d7ad0c56a2ac25bddd7f008397ebfdff355688f2e56f1a2d9c24cb20fc6fc99323afd
|
data/CHANGELOG.md
CHANGED
@@ -8,6 +8,10 @@ Jess is in a pre-1.0 state. This means that its APIs and behavior are subject to
|
|
8
8
|
|
9
9
|
* Your contribution here!
|
10
10
|
|
11
|
+
## [0.8.0][] (2018-08-10)
|
12
|
+
|
13
|
+
* Provide more details in the exception object when an error occurs, including the full response body
|
14
|
+
|
11
15
|
## [0.7.0][] (2018-04-13)
|
12
16
|
|
13
17
|
* Roll back logging changes introduced in 0.6.0 (sorry)
|
data/jess.gemspec
CHANGED
@@ -36,6 +36,6 @@ Gem::Specification.new do |spec|
|
|
36
36
|
spec.add_development_dependency "minitest", "~> 5.0"
|
37
37
|
spec.add_development_dependency "minitest-reporters", "~>1.1"
|
38
38
|
spec.add_development_dependency "rake", "~> 12.0"
|
39
|
-
spec.add_development_dependency "rubocop", "0.
|
39
|
+
spec.add_development_dependency "rubocop", "0.56.0"
|
40
40
|
spec.add_development_dependency "webmock", "~> 3.1"
|
41
41
|
end
|
@@ -5,10 +5,11 @@ module Jess
|
|
5
5
|
# being attempted when the error occurred.
|
6
6
|
#
|
7
7
|
class Error < StandardError
|
8
|
-
attr_accessor :uri, :http_method
|
8
|
+
attr_accessor :uri, :http_method, :code, :response
|
9
9
|
|
10
10
|
def to_s
|
11
|
-
|
11
|
+
message = [code, super].join(" ").strip
|
12
|
+
"#{message} (during #{http_method.to_s.upcase} #{uri})"
|
12
13
|
end
|
13
14
|
end
|
14
15
|
|
@@ -8,11 +8,11 @@ module Jess
|
|
8
8
|
#
|
9
9
|
class ErrorDecorator < SimpleDelegator
|
10
10
|
def request(req)
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
res = super
|
12
|
+
raise_if_error_code(res)
|
13
|
+
res
|
14
14
|
rescue StandardError => e
|
15
|
-
handle_exception(e, req)
|
15
|
+
handle_exception(e, req, res)
|
16
16
|
end
|
17
17
|
|
18
18
|
private
|
@@ -26,7 +26,7 @@ module Jess
|
|
26
26
|
end
|
27
27
|
|
28
28
|
# rubocop:disable Lint/EmptyWhen
|
29
|
-
def handle_exception(err, req)
|
29
|
+
def handle_exception(err, req, res)
|
30
30
|
case err
|
31
31
|
when IOError, Timeout::Error
|
32
32
|
err = ConnectionError.new(err.message)
|
@@ -36,11 +36,24 @@ module Jess
|
|
36
36
|
err = Error.new(err.inspect)
|
37
37
|
end
|
38
38
|
|
39
|
-
err
|
40
|
-
err.http_method = req.method
|
39
|
+
fill_exception(err, req, res)
|
41
40
|
raise err
|
42
41
|
end
|
43
42
|
# rubocop:enable Lint/EmptyWhen
|
43
|
+
|
44
|
+
def fill_exception(err, req, res)
|
45
|
+
err.uri = req.uri
|
46
|
+
err.http_method = req.method
|
47
|
+
return if res.nil?
|
48
|
+
|
49
|
+
err.code = res.code
|
50
|
+
|
51
|
+
begin
|
52
|
+
err.response = res.body.to_s
|
53
|
+
rescue StandardError
|
54
|
+
err.response = nil
|
55
|
+
end
|
56
|
+
end
|
44
57
|
end
|
45
58
|
end
|
46
59
|
end
|
data/lib/jess/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jess
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Brictson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - '='
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.
|
117
|
+
version: 0.56.0
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - '='
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0.
|
124
|
+
version: 0.56.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: webmock
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -194,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
194
|
version: '0'
|
195
195
|
requirements: []
|
196
196
|
rubyforge_project:
|
197
|
-
rubygems_version: 2.7.
|
197
|
+
rubygems_version: 2.7.7
|
198
198
|
signing_key:
|
199
199
|
specification_version: 4
|
200
200
|
summary: Lightweight, unofficial client for the JAMF Software Server (JSS) API
|