exceptiontrap 1.0.6 → 1.0.7

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: 39876629b7ad8f573df03fea4a1c163b68a24727
4
- data.tar.gz: 24fbe651e1eb13486b75d2afa3319c93a0f4edcf
3
+ metadata.gz: 0b93311715f7d0d08f0718689c94acd110933473
4
+ data.tar.gz: ac9899abb8d48af4afa8043f3aa407fa34ffa8c2
5
5
  SHA512:
6
- metadata.gz: 293433525a8b53f84d90c2fa4c8564548a55bdab575861e150dce1d8ba09cbc25ab8df8d1b8c5f5b86856d32bfb3ea3c7f69d5a96ca14948622ee4164f01c2b6
7
- data.tar.gz: 0a540e69173a1702ee3a3816aea53f52bd31ddcb53397639216adbec8bcd2618e395b8f1cca601cce8cceb832cb89ee47c991cd9c83a8c727199c9d40afb5fc3
6
+ metadata.gz: e34f270ae8c72a947cec259826e0ad454bccd865aa84a24178a2ed47d793de48b934e05b027160f98d0055fe0f9c7742948d92798e9ce4679d0e9d2e1d4f7c1a
7
+ data.tar.gz: 3dff2eaf63615a43d2b9163a076841615f2c70e0c5fc6019950bfa135d50eea4dd6f5e1cb27551bbafe065b8ecba192035da2af197cd2775849cc063bf71a5b7
@@ -21,7 +21,7 @@ module Exceptiontrap
21
21
  end
22
22
 
23
23
  # Creates Notification Data for rack requests (Rails 3)
24
- def rack_data(exception, env)
24
+ def rack_data(exception, env = {})
25
25
  components = {}
26
26
  if env["action_dispatch.request.parameters"] != nil
27
27
  components[:controller] = env['action_dispatch.request.parameters'][:controller] || nil
@@ -29,6 +29,9 @@ module Exceptiontrap
29
29
  components[:module] = env['action_dispatch.request.parameters'][:module] || nil
30
30
  end
31
31
 
32
+ # For background workers like sidekiq # TODO: extract data creation for background jobs
33
+ components[:controller] ||= env[:custom_controller]
34
+
32
35
  data = {
33
36
  'notifier' => NOTIFIER_NAME,
34
37
  'name' => exception.class.name,
@@ -0,0 +1,18 @@
1
+ module Exceptiontrap
2
+ class SidekiqException
3
+ def call(worker, msg, queue)
4
+ begin
5
+ yield
6
+ rescue => exception
7
+ Exceptiontrap::notify(exception, { custom_params: msg, custom_controller: msg['class'] })
8
+ raise exception
9
+ end
10
+ end
11
+ end
12
+ end
13
+
14
+ ::Sidekiq.configure_server do |config|
15
+ config.server_middleware do |chain|
16
+ chain.add ::Exceptiontrap::SidekiqException
17
+ end
18
+ end
@@ -1,3 +1,3 @@
1
1
  module Exceptiontrap
2
- VERSION = '1.0.6'
2
+ VERSION = '1.0.7'
3
3
  end
data/lib/exceptiontrap.rb CHANGED
@@ -9,6 +9,8 @@ require 'exceptiontrap/rack'
9
9
 
10
10
  # Use Rack Middleware for Rails 3
11
11
  require 'exceptiontrap/railtie' if defined?(Rails::Railtie)
12
+ # Background Worker Middleware
13
+ require "exceptiontrap/sidekiq" if defined?(Sidekiq)
12
14
 
13
15
  # Exceptiontrap
14
16
  module Exceptiontrap
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exceptiontrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - tbuehl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-06 00:00:00.000000000 Z
11
+ date: 2013-10-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Exception notifier. The Gem catches your applications exceptions and
14
14
  sends those to the exceptiontrap webservice hosted at http://exceptiontrap.com
@@ -36,6 +36,7 @@ files:
36
36
  - lib/exceptiontrap/notifier.rb
37
37
  - lib/exceptiontrap/rack.rb
38
38
  - lib/exceptiontrap/railtie.rb
39
+ - lib/exceptiontrap/sidekiq.rb
39
40
  - lib/exceptiontrap/version.rb
40
41
  - lib/generators/exceptiontrap/exceptiontrap_generator.rb
41
42
  - lib/generators/exceptiontrap/templates/exceptiontrap.yml