upfluence-thrift 1.0.10 → 1.0.11

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/thrift/processor.rb +34 -10
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0585c5dcf84ea7d019dfe7391d031ad89b8f51ed
4
- data.tar.gz: 3569d6e14d9d6e2eac720b4569398c9e7b9ae537
3
+ metadata.gz: 41dea1fac87e62e08f31f9fca894dde1a3b33247
4
+ data.tar.gz: 03136b94c08b9a1eaeb03f51ee5f5b9797da7eac
5
5
  SHA512:
6
- metadata.gz: 0c580dc31d5b3c8f31befb3baef6e3bc4e285698de536c35714f3a5c21d7f0b13bf42976f85945f0bd792381f6626ef2830d8c24fac9b5eeee1d509e14918704
7
- data.tar.gz: f4a193a77d42cd34efc2366dda0a70c1da5fb4d24433fe70fc0f38c39ef4679e432a99fbc6319dd609bd1228cd48554061975d68f1c4ffaba391817a4d1ce8ee
6
+ metadata.gz: 3a33f22c457a6c8606d33d6e3e27da1099cf3463502433132016219e8266576daaca0b21155e866871a5399c4269f2b84c201e31dfcf31a95519107386fc8ffb
7
+ data.tar.gz: 82d36e40a917bfe445beac495dcb944ccded0cdb7ced3f414ce90993888e14deaff0c7d50693e41b338ce9e911a841e7ce81879a305e419952b72f179b2db3b8
@@ -6,16 +6,16 @@
6
6
  # to you under the Apache License, Version 2.0 (the
7
7
  # "License"); you may not use this file except in compliance
8
8
  # with the License. You may obtain a copy of the License at
9
- #
9
+ #
10
10
  # http://www.apache.org/licenses/LICENSE-2.0
11
- #
11
+ #
12
12
  # Unless required by applicable law or agreed to in writing,
13
13
  # software distributed under the License is distributed on an
14
14
  # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
15
  # KIND, either express or implied. See the License for the
16
16
  # specific language governing permissions and limitations
17
17
  # under the License.
18
- #
18
+ #
19
19
 
20
20
  module Thrift
21
21
  module Processor
@@ -24,18 +24,27 @@ module Thrift
24
24
  end
25
25
 
26
26
  def process(iprot, oprot)
27
- name, type, seqid = iprot.read_message_begin
27
+ name, _type, seqid = iprot.read_message_begin
28
28
  if respond_to?("process_#{name}")
29
- send("process_#{name}", seqid, iprot, oprot)
29
+ begin
30
+ send("process_#{name}", seqid, iprot, oprot)
31
+ rescue => e
32
+ write_exception(e, oprot, name, seqid)
33
+ end
34
+
30
35
  true
31
36
  else
32
37
  iprot.skip(Types::STRUCT)
33
38
  iprot.read_message_end
34
- x = ApplicationException.new(ApplicationException::UNKNOWN_METHOD, 'Unknown function '+name)
35
- oprot.write_message_begin(name, MessageTypes::EXCEPTION, seqid)
36
- x.write(oprot)
37
- oprot.write_message_end
38
- oprot.trans.flush
39
+ write_exception(
40
+ ApplicationException.new(
41
+ ApplicationException::UNKNOWN_METHOD,
42
+ 'Unknown function '+name,
43
+ ),
44
+ oprot,
45
+ name,
46
+ seqid
47
+ )
39
48
  false
40
49
  end
41
50
  end
@@ -47,6 +56,21 @@ module Thrift
47
56
  args
48
57
  end
49
58
 
59
+ def write_exception(exception, oprot, name, seqid)
60
+ oprot.write_message_begin(name, MessageTypes::EXCEPTION, seqid)
61
+
62
+ unless exception.is_a? ApplicationException
63
+ exception = ApplicationException.new(
64
+ ApplicationException::INTERNAL_ERROR,
65
+ "Internal error processing #{name}: #{exception.class}: #{exception}"
66
+ )
67
+ end
68
+
69
+ exception.write(oprot)
70
+ oprot.write_message_end
71
+ oprot.trans.flush
72
+ end
73
+
50
74
  def write_result(result, oprot, name, seqid)
51
75
  oprot.write_message_begin(name, MessageTypes::REPLY, seqid)
52
76
  result.write(oprot)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: upfluence-thrift
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.10
4
+ version: 1.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thrift Developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-06 00:00:00.000000000 Z
11
+ date: 2017-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec