bumbleworks 0.0.86 → 0.0.87

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: 803b0ca4b01ae7606eb47ce6c2037656f7d92564
4
- data.tar.gz: e5fa78cad9e93b529310cfd7df343cca83026061
3
+ metadata.gz: ddb99ff7e81ef79f450c5888713b862a3dd85673
4
+ data.tar.gz: 5b3de42cac468a392998375432725b33d1bbf501
5
5
  SHA512:
6
- metadata.gz: 4f5e0d79e475abb6cdde5a7e77f494804f81623a98dd9b09a1f5275b0a4ebe7e0da3e19d967117a595b8716577ea607951f4d7d5f31cee8978368fd9ab3f8d94
7
- data.tar.gz: 4c7d72432405cdf5c44da24b09888436865a1a2ef7db212501cff7099b0e0425f767ab0e36d3b0034ef4b0c75544a116e73c69acd107b90bf1805b52337a9744
6
+ metadata.gz: b91712d329d034b868e3aa1579d7b2a84ec4eab9bea15aea43e72ff1c9187ee3546d3c1e36d53d3f12c7095d246b8d592c3903126f9ca2b9b49057f0f3147f09
7
+ data.tar.gz: ff019980495f03d0c3622329cc8d3e9f3d7e516758b329ef49ac8ac287d2b3d462887179d39ccc59dc6003f2fc4afb06f6b89eb92ef2941c7816bb7f7f9efc12
@@ -186,6 +186,18 @@ module Bumbleworks
186
186
  Bumbleworks::Process.new(pid)
187
187
  end
188
188
 
189
+ # @public
190
+ # Instantiates a new Bumbleworks::Process::ErrorRecord for each error
191
+ # in the Ruote storage.
192
+ #
193
+ def errors
194
+ Bumbleworks.dashboard.context.storage.get_many('errors').map { |err|
195
+ Bumbleworks::Process::ErrorRecord.new(
196
+ ::Ruote::ProcessError.new(err)
197
+ )
198
+ }
199
+ end
200
+
189
201
  private
190
202
 
191
203
  def extract_entity_from_fields!(fields)
@@ -3,6 +3,9 @@ module Bumbleworks
3
3
  class ErrorRecord
4
4
  attr_reader :process_error
5
5
 
6
+ extend Forwardable
7
+ delegate [:fei, :workitem, :wfid] => :process_error
8
+
6
9
  # The initializer takes a Ruote::ProcessError instance.
7
10
  def initialize(process_error)
8
11
  @process_error = process_error
@@ -15,15 +18,14 @@ module Bumbleworks
15
18
  Bumbleworks.dashboard.replay_at_error(@process_error)
16
19
  end
17
20
 
18
- # Returns the workitem at the position where this error occurred.
19
- def workitem
20
- @process_error.workitem
21
+ # Returns the expression where this error occurred.
22
+ def expression
23
+ Bumbleworks::Expression.from_fei(fei)
21
24
  end
22
25
 
23
- # Returns the FlowExpressionId of the expression where this error
24
- # occurred.
25
- def fei
26
- @process_error.fei
26
+ # Returns the process in which this error occurred.
27
+ def process
28
+ Bumbleworks::Process.new(wfid)
27
29
  end
28
30
 
29
31
  # Returns the class name of the error that was actually raised
@@ -1,3 +1,3 @@
1
1
  module Bumbleworks
2
- VERSION = "0.0.86"
2
+ VERSION = "0.0.87"
3
3
  end
@@ -49,6 +49,21 @@ describe Bumbleworks::Process::ErrorRecord do
49
49
  end
50
50
  end
51
51
 
52
+ describe '#process' do
53
+ it 'returns the process in which the error occurred' do
54
+ expect(@error.process).to eq @process
55
+ end
56
+ end
57
+
58
+ describe '#expression' do
59
+ it 'returns the expression from when the error occurred' do
60
+ expression = @error.expression
61
+ expect(expression).to be_a(Bumbleworks::Expression)
62
+ expect(expression.process).to eq @process
63
+ expect(expression.expid).to eq '0_0'
64
+ end
65
+ end
66
+
52
67
  describe '#message' do
53
68
  it 'returns the original error message' do
54
69
  expect(@error.message).to eq 'Oh crumb.'
@@ -280,4 +280,29 @@ describe Bumbleworks do
280
280
  expect(described_class.store_history?).to be_falsy
281
281
  end
282
282
  end
283
+
284
+ describe '.errors' do
285
+ it 'returns all errors as ErrorRecord instances' do
286
+ Bumbleworks.start_worker!
287
+ Bumbleworks.define_process 'error_process' do
288
+ concurrence do
289
+ error 'first error'
290
+ error 'second error'
291
+ end
292
+ end
293
+ bp1 = Bumbleworks.launch!('error_process')
294
+ bp2 = Bumbleworks.launch!('error_process')
295
+ Bumbleworks.dashboard.wait_for('error_intercepted')
296
+ errors = described_class.errors
297
+ expect(errors.map(&:class).uniq).to eq([
298
+ Bumbleworks::Process::ErrorRecord
299
+ ])
300
+ expect(errors.map(&:message)).to match_array([
301
+ 'first error',
302
+ 'second error',
303
+ 'first error',
304
+ 'second error'
305
+ ])
306
+ end
307
+ end
283
308
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bumbleworks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.86
4
+ version: 0.0.87
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maher Hawash
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-09-04 00:00:00.000000000 Z
14
+ date: 2014-09-26 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: ruote