oni 2.0.1 → 3.0.0

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Y2EyNTdkYTM0ZmE1MmExMzVhNDNmNjNiNjdjM2ViMTEyYmM5ZWZkYQ==
4
+ Y2JlMGI4N2NhZDZmMDdmYTVjNWY0ZjExY2E5YzlmNGVlOWQ0Y2FjNg==
5
5
  data.tar.gz: !binary |-
6
- YzRlODYyZTdmNjI5YThkNjBkY2ZkN2ZkMTU5NTg0OTc2ODVmMTdkZg==
6
+ NjAyMmEwMDA0YzYwZjQ1ZWQzNWNjYjVmNGI5N2YxYmY1NTJmYjhjZg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- N2FjOWI4YmQ2NzQ2ZWM1OTYwMTJjMjE3ZDBhNjNjYmFjZDlkNzQ3MzQxZDQ1
10
- Y2QzMDc1YzVmMjRkMDU4MWIwNmRhNmVmYjgxNmQ4OTJkYTFjMWMxMDFlZTM4
11
- MmNlMTFkZGY3NTE1YmZkNmJkZWY4YjE4ZWU2NTNkOTMxMGRkMTg=
9
+ ODZjNTI3ZjlkZjZlOTNkZmU5YmQ4YzE1Zjc2N2FjMzMxMjI3M2ZlNjFlNWRl
10
+ OGYzMDQ0YTgwMTFkYjE3MzJlOTQ5MGU2NGRmZDljMDk3NmU4YTYzM2Q4NTY4
11
+ MWJkZjM1ZDliOTEzMDM3ZDk0YzBkMTZjMjg1OGJjNmZhMjIxMDY=
12
12
  data.tar.gz: !binary |-
13
- NDRiODhjYmIwNzRlMTIzZWY2MGJiY2IxYTVjYjViMmZhMDA3YTFhNGYzN2Fm
14
- NjNhYzMyMGM0NDIzYzFlNjAwMDk0ZDE0MWY1NzU4YjZiMGFmMjMxYmYzYmNm
15
- ZmQ2YTVlOGE3OTJmZTQwMjk3YzAyNDNiMzZlYTdhNjg4MTVhZWU=
13
+ MDI0MjdmMTE2MGE4ZDA3ZGE0NWJlYzAyNjliYmQxMjIzZjQ1ZjlhOGU2MmIy
14
+ ZTljNjNkNDkzNTYyZWRmZDU5YzE2YTk4NWNmZmVlODZhY2IyMjFjYTA4Y2Uy
15
+ OWQ1MzY1YzdmNDUzM2U3YTBmODEzZTA5MDYzMjNlNjBkNzc0OGM=
@@ -1,6 +1,11 @@
1
1
  # @title Changelog
2
2
  # Changelog
3
3
 
4
+ ## 3.0.0 - December 17th, 2013
5
+
6
+ This release reverts the changes of version 2.0.0 and 2.0.1 as they proved to
7
+ be too problematic.
8
+
4
9
  ## 2.0.1 - December 17th, 2013
5
10
 
6
11
  * Fixed a bug where the complete() callback would be executed upon worker
@@ -87,17 +87,13 @@ module Oni
87
87
  output = run_worker(message)
88
88
  end
89
89
 
90
- complete(message, output, timings) unless output == false
90
+ complete(message, output, timings)
91
91
  end
92
92
 
93
93
  ##
94
94
  # Maps the input, runs the worker and then maps the output into something
95
95
  # that the daemon can understand.
96
96
  #
97
- # If the worker's `process` method raises an error `false` is returned and
98
- # the `complete` callback is skipped, otherwise the remapped output is
99
- # returned.
100
- #
101
97
  # @param [Mixed] message
102
98
  # @return [Mixed]
103
99
  #
@@ -105,15 +101,9 @@ module Oni
105
101
  mapper = create_mapper
106
102
  input = mapper.map_input(message)
107
103
  worker = option(:worker).new(*input)
108
- output = false
109
-
110
- begin
111
- output = mapper.map_output(worker.process)
112
- rescue => error
113
- error(error, worker.extra_error_data)
114
- end
104
+ output = worker.process
115
105
 
116
- return output
106
+ return mapper.map_output(output)
117
107
  end
118
108
 
119
109
  ##
@@ -145,13 +135,9 @@ module Oni
145
135
  # Called whenever an error is raised in the daemon, mapper or worker. By
146
136
  # default this method just re-raises the error.
147
137
  #
148
- # Note that this callback method is called from a thread in which the
149
- # exception occured, not from the main thread.
150
- #
151
138
  # @param [StandardError] error
152
- # @param [Mixed] extra_data Extra data made available to the method.
153
139
  #
154
- def error(error, extra_data = nil)
140
+ def error(error)
155
141
  raise error
156
142
  end
157
143
 
@@ -1,3 +1,3 @@
1
1
  module Oni
2
- VERSION = '2.0.1'
2
+ VERSION = '3.0.0'
3
3
  end # Oni
@@ -14,20 +14,5 @@ module Oni
14
14
  def process
15
15
  raise NotImplementedError, 'You must implement #process yourself'
16
16
  end
17
-
18
- ##
19
- # Method for returning (optional) extra data that should be sent to
20
- # {Oni::Daemon#error} upon encountering an error. This method can be used
21
- # to for example return the mapped input so that it can be sent to Rollbar.
22
- #
23
- # @example
24
- # def extra_error_data
25
- # return {:user_id => current_user.id}
26
- # end
27
- #
28
- # @return [Mixed]
29
- #
30
- def extra_error_data
31
- end
32
17
  end # Worker
33
18
  end # Oni
@@ -22,10 +22,6 @@ describe Oni::Daemon do
22
22
  def process
23
23
  return @number * 2
24
24
  end
25
-
26
- def extra_error_data
27
- return @number
28
- end
29
25
  end
30
26
 
31
27
  Class.new(Oni::Daemon) do
@@ -159,30 +155,4 @@ describe Oni::Daemon do
159
155
  lambda { daemon.start }.should raise_error(RuntimeError, 'custom error')
160
156
  end
161
157
  end
162
-
163
- context 'error handling with extra data' do
164
- example 'include the extra data' do
165
- instance = example_daemon.new
166
-
167
- instance.option(:worker).any_instance.stub(:process) { raise 'example' }
168
-
169
- block = lambda { instance.run_worker(:number => 10) }
170
-
171
- block.should raise_error(RuntimeError, 'example: 10')
172
- end
173
-
174
- example 'skip the complete() callback upon failure' do
175
- instance = example_daemon.new
176
-
177
- instance.option(:worker).any_instance.stub(:process) { raise 'boom' }
178
-
179
- block = lambda { instance.process(:number => 10) }
180
-
181
- # The complete() callback should be skipped.
182
- instance.should_not receive(:complete)
183
-
184
- # Regular error handling should *not* be skipped.
185
- block.should raise_error(RuntimeError, 'boom: 10')
186
- end
187
- end
188
158
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oni
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yorick Peterse