qs 0.7.0 → 0.7.1

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
- data.tar.gz: 110c7cbf5c19120501d4dfae9f332e428363aff3
4
- metadata.gz: 053fda8d651bb4509a99537ef8b8edb906a80acd
3
+ metadata.gz: d8323a541fe5820763e01fd9bc86e1ce69e5c64d
4
+ data.tar.gz: 5470362402e0cab14f67f96005001d61c62925c0
5
5
  SHA512:
6
- data.tar.gz: 6c145c40e72aecad5c87b33709a3a3aa097a07a4bd08a17819d23965efd36fdbe46312a01fd638f346e4e34a2c7cc4c2ab85af7a9951083e97aae68f93527624
7
- metadata.gz: 56bff595f01f50dba796e2b436b842376188d3c031ab6cb88395bb7cc41e04250217c04ef5eedc78ba221586795045ba8e6b739816cbe65d89cb01dacd9607ab
6
+ metadata.gz: 1d6d9367d3e72939e184a40271e5a413bd15f695d7e28ad5efe5d08fc92f80409e5e6c4a2e9701b999633a97d793af63622aeaa4857ea2011bd7b7582aac68fd
7
+ data.tar.gz: 05df115c14aa8d118b5c9582d25eca88f6008c13ab84c42009d7ed022b84fd027113f0708cf6c68ad92d8a7e115ca6f140b3c60247d7fda6c196d6add4f848a4
@@ -1,9 +1,15 @@
1
+ require 'dat-worker-pool/worker'
1
2
  require 'qs/queue'
2
3
 
3
4
  module Qs
4
5
 
5
6
  class ErrorHandler
6
7
 
8
+ # these are standard error classes that we rescue and run through any
9
+ # configured error procs; use the same standard error classes that
10
+ # dat-worker-pool rescues
11
+ STANDARD_ERROR_CLASSES = DatWorkerPool::Worker::STANDARD_ERROR_CLASSES
12
+
7
13
  attr_reader :exception, :context, :error_procs
8
14
 
9
15
  def initialize(exception, context_hash)
@@ -21,7 +27,7 @@ module Qs
21
27
  @error_procs.each do |error_proc|
22
28
  begin
23
29
  error_proc.call(@exception, @context)
24
- rescue StandardError => proc_exception
30
+ rescue *STANDARD_ERROR_CLASSES => proc_exception
25
31
  @exception = proc_exception
26
32
  end
27
33
  end
@@ -50,7 +50,7 @@ module Qs
50
50
  handle_exception(error, daemon_data, queue_item)
51
51
  end
52
52
  raise exception
53
- rescue StandardError => exception
53
+ rescue *Qs::ErrorHandler::STANDARD_ERROR_CLASSES => exception
54
54
  handle_exception(exception, daemon_data, queue_item)
55
55
  end
56
56
 
@@ -1,3 +1,3 @@
1
1
  module Qs
2
- VERSION = "0.7.0"
2
+ VERSION = "0.7.1"
3
3
  end
data/qs.gemspec CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |gem|
21
21
  gem.add_development_dependency("assert", ["~> 2.16.1"])
22
22
  gem.add_development_dependency("scmd", ["~> 3.0.2"])
23
23
 
24
- gem.add_dependency("dat-worker-pool", ["~> 0.6.1"])
24
+ gem.add_dependency("dat-worker-pool", ["~> 0.6.3"])
25
25
  gem.add_dependency("hella-redis", ["~> 0.3.1"])
26
26
  gem.add_dependency("much-plugin", ["~> 0.2.0"])
27
27
  gem.add_dependency("much-timeout", ["~> 0.1.0"])
@@ -1,5 +1,6 @@
1
1
  require 'assert/factory'
2
2
  require 'qs/dispatch_job'
3
+ require 'qs/error_handler'
3
4
  require 'qs/job'
4
5
  require 'qs/event'
5
6
 
@@ -15,6 +16,10 @@ module Factory
15
16
  exception
16
17
  end
17
18
 
19
+ def self.qs_std_error(message = nil)
20
+ self.exception(Qs::ErrorHandler::STANDARD_ERROR_CLASSES.sample, message)
21
+ end
22
+
18
23
  def self.message(params = nil)
19
24
  self.send([:job, :event].sample, params)
20
25
  end
@@ -9,7 +9,7 @@ class Qs::ErrorHandler
9
9
  class UnitTests < Assert::Context
10
10
  desc "Qs::ErrorHandler"
11
11
  setup do
12
- @exception = Factory.exception
12
+ @exception = Factory.qs_std_error
13
13
  @daemon_data = Qs::DaemonData.new
14
14
  @queue_redis_key = Qs::Queue::RedisKey.new(Factory.string)
15
15
  @context_hash = {
@@ -24,6 +24,11 @@ class Qs::ErrorHandler
24
24
  end
25
25
  subject{ @handler_class }
26
26
 
27
+ should "know its standard error classes" do
28
+ exp = DatWorkerPool::Worker::STANDARD_ERROR_CLASSES
29
+ assert_equal exp, subject::STANDARD_ERROR_CLASSES
30
+ end
31
+
27
32
  end
28
33
 
29
34
  class InitSetupTests < UnitTests
@@ -79,7 +84,7 @@ class Qs::ErrorHandler
79
84
  desc "and run with error procs that throw exceptions"
80
85
  setup do
81
86
  @proc_exceptions = @error_proc_spies.reverse.map do |spy|
82
- exception = Factory.exception(RuntimeError, @error_proc_spies.index(spy).to_s)
87
+ exception = Factory.qs_std_error(@error_proc_spies.index(spy).to_s)
83
88
  spy.raise_exception = exception
84
89
  exception
85
90
  end
@@ -77,7 +77,7 @@ class Qs::PayloadHandler
77
77
 
78
78
  class RunWithExceptionSetupTests < InitTests
79
79
  setup do
80
- @route_exception = Factory.exception
80
+ @route_exception = Factory.qs_std_error
81
81
  Assert.stub(@route_spy, :run){ raise @route_exception }
82
82
  Assert.stub(Qs::ErrorHandler, :new) do |*args|
83
83
  @error_handler_spy = ErrorHandlerSpy.new(*args)
@@ -186,7 +186,7 @@ class Qs::PayloadHandler
186
186
  class LoggingJobErrorTests < LoggingJobSetupTests
187
187
  desc "that errors while being processed"
188
188
  setup do
189
- @route_exception = Factory.exception
189
+ @route_exception = Factory.qs_std_error
190
190
  Assert.stub(@route_spy, :run){ raise @route_exception }
191
191
 
192
192
  @payload_handler.run
@@ -260,7 +260,7 @@ class Qs::PayloadHandler
260
260
  class LoggingEventErrorTests < LoggingEventSetupTests
261
261
  desc "that errors while being processed"
262
262
  setup do
263
- @route_exception = Factory.exception
263
+ @route_exception = Factory.qs_std_error
264
264
  Assert.stub(@route_spy, :run){ raise @route_exception }
265
265
 
266
266
  @payload_handler.run
@@ -294,7 +294,7 @@ class Qs::PayloadHandler
294
294
  @message = Factory.message
295
295
  setup_for_message(@message)
296
296
 
297
- Assert.stub(Qs::Payload, :deserialize){ raise Factory.exception }
297
+ Assert.stub(Qs::Payload, :deserialize){ raise Factory.qs_std_error }
298
298
 
299
299
  @payload_handler = @handler_class.new(@daemon_data, @queue_item)
300
300
  @payload_handler.run
@@ -430,7 +430,7 @@ class Qs::PayloadHandler
430
430
  def initialize(exception, context_hash)
431
431
  @passed_exception = exception
432
432
  @context_hash = context_hash
433
- @exception = Factory.exception
433
+ @exception = Factory.qs_std_error
434
434
  @run_called = false
435
435
  end
436
436
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kelly Redding
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2016-06-15 00:00:00 Z
13
+ date: 2016-06-29 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: assert
@@ -39,7 +39,7 @@ dependencies:
39
39
  requirements:
40
40
  - - ~>
41
41
  - !ruby/object:Gem::Version
42
- version: 0.6.1
42
+ version: 0.6.3
43
43
  type: :runtime
44
44
  version_requirements: *id003
45
45
  - !ruby/object:Gem::Dependency