elementary-rpc 2.9.2.92 → 2.9.3.95

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9acc4eb809754a00ec82c653e50a3cc6a3294223
4
- data.tar.gz: b1adcb7364d5b728a74745b6972fbae069cb7f70
3
+ metadata.gz: 4ffd1bd44033b7ee5eecf3cf0c70d189e907a0f2
4
+ data.tar.gz: e2f5c84b79b847bcb5dd5a2bfa4d186837b6bdca
5
5
  SHA512:
6
- metadata.gz: cda24d487deb7eb2311e510c061a8216a12cbafce79359998919ad0645f3c45c2b3f71e66776ed6afc33535f09e91a2c761a4f220da3e38fd16dfed4b1537127
7
- data.tar.gz: 54d669a449e2c577052205e53abfa959c4b0c33cf454f05ea4dbd3b636946a76aa2bcac1bfc56f304c9772f05693a66319d584cea84f8409e9243cf5d25b79d0
6
+ metadata.gz: 9540affa9a20ec05870bdf725a66cc71dc2465968b51becba7513c025d1967821ed773597df5de6d7732575cb955eeceec11fd460723ce0da6aedc03bd70603c
7
+ data.tar.gz: 61d351a3c717a660cd4c78a4cfa93154217f1f09206c9e75eaa646d3b791509a74e2d89989d6abc9f22abeaf25f92b135050c2ead0fdab135571957821f3978f
@@ -36,7 +36,12 @@ module Elementary
36
36
 
37
37
  return rpc_method[:response_type].decode(response.body)
38
38
  rescue StandardError => e
39
- raise e.exception("#{service.name}##{rpc_method.method}: #{e.message}")
39
+ if e.respond_to?(:exception)
40
+ raise e.exception("#{service.name}##{rpc_method.method}: #{e.message}")
41
+ else
42
+ # java.lang.Exceptions don't implement #exception
43
+ raise e.class.new("#{service.name}##{rpc_method.method}: #{e.message}")
44
+ end
40
45
  end
41
46
  end
42
47
 
@@ -1,3 +1,3 @@
1
1
  module Elementary
2
- VERSION = "2.9.2"
2
+ VERSION = "2.9.3"
3
3
  end
@@ -113,4 +113,33 @@ describe Elementary::Transport::HTTP do
113
113
  end
114
114
  end
115
115
  end
116
+
117
+ describe "#call" do
118
+ let(:hosts) { [{host: 'example.com', port: 80}] }
119
+ let(:service) { double('Protobuf::Service', name: 'fake_service' ) }
120
+ let(:rpc_method) { double('Protobuf::RpcMethod', method: 'fake_method') }
121
+ let(:protobuf) { double('Protobuf', encode: 'encoded_protobuf') }
122
+ subject(:call) { http.call(service, rpc_method, protobuf) }
123
+
124
+ context 'raises error' do
125
+ let(:error) { Elementary::Errors::RPCFailure.new({header_code: 500, header_message: 'rpc_failure'}) }
126
+ it 'should re-raise' do
127
+ expect(http).to receive(:client).and_raise(error)
128
+ expect { subject }.to raise_error error.class, /#{service.name}##{rpc_method.method}: #{error.message}/
129
+ end
130
+ end
131
+
132
+ if RUBY_PLATFORM == 'java'
133
+ # Can't easily do this this in MRI -- stubbing respond_to on the
134
+ # exception to return false for :exception makes RSpec think
135
+ # it's not an exception
136
+ context 'raises java exception' do
137
+ let(:error) { java.net.SocketException.new('oops') }
138
+ it 'should re-raise' do
139
+ expect(http).to receive(:client).and_raise(error)
140
+ expect { subject }.to raise_error error.class, /#{service.name}##{rpc_method.method}: #{error.message}/
141
+ end
142
+ end
143
+ end
144
+ end
116
145
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elementary-rpc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.2.92
4
+ version: 2.9.3.95
5
5
  platform: ruby
6
6
  authors:
7
7
  - R. Tyler Croy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-04 00:00:00.000000000 Z
11
+ date: 2017-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler