rollbar 2.3.0 → 2.4.0

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: 6e71e17b7e4734a7d1f0ef5b089a35786b962b4e
4
- data.tar.gz: 6b91570fd7e15397aa2100e0e2e99339d99544b0
3
+ metadata.gz: 0ee59f6efb2ed9591c13fd03dd37eeed85c4b4d5
4
+ data.tar.gz: 65970f20f1642e47866019178365991fafd6f6bf
5
5
  SHA512:
6
- metadata.gz: 5d768005681a92731a4947f3f8afb7db45cf73f2cc51119495e731dd7cf8fdf3b58c7dc6220e234e47f3dc00acf1c1b50c4870763b7685e6e8ec362f5001cf5d
7
- data.tar.gz: 0383bbc528d88144cf755ac2d7042fcb4165faa521d69c58f65f2a2ebb7be1db17dddd98cd5c41187e85fbc8264e20f0cc12555a32bd577725f49d3c2ade2b37
6
+ metadata.gz: dcb250c0823c101c5b0b29e56b6a05dc7b2cab3f2f20337f9ef4ca6a3b2277f67e5fa266c40b92659bd3f34f4fdfa8479a05c03d8447322f7fec47e976ce633e
7
+ data.tar.gz: 890c9a76c08386c2322d688e1560427a68e125a18399101a3ca573de152b607b2fafd60cea506af2c5cedcb1df1774d24c2e2bb8025471fc7d9838bac7cc4c30
@@ -1,5 +1,26 @@
1
1
  # Change Log
2
2
 
3
+ ## 2.4.0
4
+
5
+ Features:
6
+
7
+ - Allow custom revision name on capistrano integration. See [#312](https://github.com/rollbar/rollbar-gem/pull/312)
8
+
9
+ Internal changes:
10
+
11
+ - Restore MultiJson and add custom option modules. Fix #303. See [#304](https://github.com/rollbar/rollbar-gem/pull/304)
12
+ - Don't require rollbar/rails on initializer. See [#310](https://github.com/rollbar/rollbar-gem/pull/310)
13
+ - Fix delayed_job tests for delayed_job >= 4.1. See [#309](https://github.com/rollbar/rollbar-gem/pull/309)
14
+
15
+ Documentation:
16
+
17
+ - Change README.md and template to use 'default' Sidekiq queue. See [#306](https://github.com/rollbar/rollbar-gem/pull/306)
18
+
19
+ Bug fixes:
20
+
21
+ - Remove better errors hook. This was causing to report twice the errors. See [#313](https://github.com/rollbar/rollbar-gem/pull/300)
22
+
23
+
3
24
  ## 2.3.0
4
25
 
5
26
  Internal changes:
data/Gemfile CHANGED
@@ -11,6 +11,7 @@ gem "racc", :platform => :rbx
11
11
  gem "minitest", :platform => :rbx
12
12
  gem "rubinius-developer_tools", :platform => :rbx
13
13
  gem "rails", "4.2.3"
14
+ gem 'byebug'
14
15
 
15
16
  gemspec
16
- gem 'byebug'
17
+
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Rollbar notifier for Ruby [![Build Status](https://api.travis-ci.org/rollbar/rollbar-gem.svg?branch=v2.3.0)](https://travis-ci.org/rollbar/rollbar-gem/branches)
1
+ # Rollbar notifier for Ruby [![Build Status](https://api.travis-ci.org/rollbar/rollbar-gem.svg?branch=v2.4.0)](https://travis-ci.org/rollbar/rollbar-gem/branches)
2
2
 
3
3
  <!-- RemoveNext -->
4
4
  [Rollbar](https://rollbar.com) is an error tracking service for Ruby and other languages. The Rollbar service will alert you of problems with your code and help you understand them in a ways never possible before. We love it and we hope you will too.
@@ -12,7 +12,13 @@ This is the Ruby library for Rollbar. It will instrument many kinds of Ruby appl
12
12
  Add this line to your application's Gemfile:
13
13
 
14
14
  ```ruby
15
- gem 'rollbar', '~> 2.3.0'
15
+ gem 'rollbar', '~> 2.4.0'
16
+ ```
17
+
18
+ If you are not using JRuby we suggest using [Oj](https://github.com/ohler55/oj) for JSON serialization. In order to install Oj you can add this line to your Gemfile:
19
+
20
+ ```ruby
21
+ gem 'oj', '~> 2.12.14'
16
22
  ```
17
23
 
18
24
  And then execute:
@@ -465,10 +471,11 @@ Add the following in ```config/initializers/rollbar.rb```:
465
471
  config.use_sidekiq
466
472
  ```
467
473
 
468
- You can also supply custom Sidekiq options:
474
+
475
+ The default Sidekiq queue will be `rollbar` but you can also supply custom Sidekiq options:
469
476
 
470
477
  ```ruby
471
- config.use_sidekiq 'queue' => 'my_queue'
478
+ config.use_sidekiq 'queue' => 'default'
472
479
  ```
473
480
 
474
481
  Start the redis server:
@@ -1,4 +1,3 @@
1
- require 'rollbar/rails'
2
1
  Rollbar.configure do |config|
3
2
  # Without configuration, Rollbar is enabled in all environments.
4
3
  # To disable in specific environments, set config.enabled=false.
@@ -56,5 +55,5 @@ Rollbar.configure do |config|
56
55
  # Enable delayed reporting (using Sidekiq)
57
56
  # config.use_sidekiq
58
57
  # You can supply custom Sidekiq options:
59
- # config.use_sidekiq 'queue' => 'my_queue'
58
+ # config.use_sidekiq 'queue' => 'default'
60
59
  end
@@ -740,17 +740,12 @@ module Rollbar
740
740
 
741
741
  yield(configuration)
742
742
 
743
- configure_json_backend
744
743
  require_hooks
745
744
  require_core_extensions
746
745
 
747
746
  reset_notifier!
748
747
  end
749
748
 
750
- def configure_json_backend
751
- Rollbar::JSON.setup
752
- end
753
-
754
749
  def reconfigure
755
750
  @configuration = Configuration.new
756
751
  @configuration.enabled = true
@@ -781,7 +776,6 @@ module Rollbar
781
776
  require 'rollbar/goalie' if defined?(Goalie)
782
777
  require 'rollbar/rack' if defined?(Rack)
783
778
  require 'rollbar/rake' if defined?(Rake)
784
- require 'rollbar/better_errors' if defined?(BetterErrors)
785
779
  end
786
780
 
787
781
  def require_core_extensions
@@ -33,6 +33,12 @@ module Rollbar
33
33
  self.wrapped = true
34
34
  end
35
35
 
36
+ def self.wrap_worker!
37
+ self.wrapped = false
38
+
39
+ wrap_worker
40
+ end
41
+
36
42
  def self.around_invoke_job(&block)
37
43
  ::Delayed::Worker.lifecycle.around(:invoke_job, &block)
38
44
  end
@@ -1,37 +1,64 @@
1
+ require 'multi_json'
2
+ require 'rollbar/json/oj'
3
+ require 'rollbar/json/default'
4
+
5
+ begin
6
+ require 'oj'
7
+ rescue LoadError
8
+ end
9
+
1
10
  module Rollbar
2
11
  module JSON
3
12
  extend self
4
13
 
5
- attr_accessor :backend_name
6
- attr_accessor :dump_method
7
- attr_accessor :load_method
14
+ attr_writer :options_module
15
+
16
+ def dump(object)
17
+ with_adapter { MultiJson.dump(object, adapter_options) }
18
+ end
19
+
20
+ def load(string)
21
+ with_adapter { MultiJson.load(string, adapter_options) }
22
+ end
8
23
 
9
- def load_oj
10
- require 'oj'
24
+ def with_adapter(&block)
25
+ MultiJson.with_adapter(detect_multi_json_adapter, &block)
26
+ end
11
27
 
12
- options = { :mode=> :compat,
13
- :use_to_json => false,
14
- :symbol_keys => false,
15
- :circular => false
16
- }
28
+ def detect_multi_json_adapter
29
+ options = {}
30
+ options[:adapter] = :oj if defined?(::Oj)
17
31
 
18
- self.dump_method = proc { |obj| Oj.dump(obj, options) }
19
- self.load_method = proc { |obj| Oj.load(obj, options) }
20
- self.backend_name = :oj
32
+ MultiJson.current_adapter(options)
33
+ end
21
34
 
22
- true
35
+ def adapter_options
36
+ options_module.options
23
37
  end
24
38
 
25
- def dump(object)
26
- dump_method.call(object)
39
+ def options_module
40
+ @options_module ||= find_options_module
27
41
  end
28
42
 
29
- def load(string)
30
- load_method.call(string)
43
+ def find_options_module
44
+ module_name = multi_json_adapter_module_name
45
+
46
+ begin
47
+ const_get(module_name)
48
+ rescue NameError
49
+ Default
50
+ end
31
51
  end
32
52
 
33
- def setup
34
- load_oj
53
+ # MultiJson adapters have this name structure:
54
+ # "MultiJson::Adapters::{AdapterModule}"
55
+ #
56
+ # Ex: MultiJson::Adapters::Oj
57
+ # Ex: MultiJson::Adapters::JsonGem
58
+ #
59
+ # In this method we just get the last module name.
60
+ def multi_json_adapter_module_name
61
+ MultiJson.current_adapter.name[/^MultiJson::Adapters::(.*)$/, 1]
35
62
  end
36
63
  end
37
64
  end
@@ -0,0 +1,11 @@
1
+ module Rollbar
2
+ module JSON
3
+ module Default
4
+ extend self
5
+
6
+ def options
7
+ {}
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,15 @@
1
+ module Rollbar
2
+ module JSON
3
+ module Oj
4
+ extend self
5
+
6
+ def options
7
+ { :mode=> :compat,
8
+ :use_to_json => false,
9
+ :symbol_keys => false,
10
+ :circular => false
11
+ }
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,22 +1,5 @@
1
- require 'rollbar'
2
-
3
1
  module Rollbar
4
2
  module Rails
5
- def self.initialize
6
- rails_logger = if defined?(::Rails.logger)
7
- ::Rails.logger
8
- elsif defined?(RAILS_DEFAULT_LOGGER)
9
- RAILS_DEFAULT_LOGGER
10
- end
11
3
 
12
- Rollbar.preconfigure do |config|
13
- config.logger = rails_logger
14
- config.environment = defined?(::Rails.env) && ::Rails.env || defined?(RAILS_ENV) && RAILS_ENV
15
- config.root = defined?(::Rails.root) && ::Rails.root || defined?(RAILS_ROOT) && RAILS_ROOT
16
- config.framework = defined?(::Rails.version) && "Rails: #{::Rails.version}" || defined?(::Rails::VERSION::STRING) && "Rails: #{::Rails::VERSION::STRING}"
17
- end
18
- end
19
4
  end
20
5
  end
21
-
22
- Rollbar::Rails.initialize
@@ -14,7 +14,7 @@ namespace :rollbar do
14
14
  :local_username => fetch(:rollbar_user),
15
15
  :access_token => fetch(:rollbar_token),
16
16
  :environment => fetch(:rollbar_env),
17
- :revision => fetch(:current_revision) }
17
+ :revision => fetch(:rollbar_revision) }
18
18
 
19
19
  debug "Building Rollbar POST to #{uri} with #{params.inspect}"
20
20
 
@@ -36,9 +36,10 @@ end
36
36
 
37
37
  namespace :load do
38
38
  task :defaults do
39
- set :rollbar_user, Proc.new { ENV['USER'] || ENV['USERNAME'] }
40
- set :rollbar_env, Proc.new { fetch :rails_env, 'production' }
41
- set :rollbar_token, Proc.new { abort "Please specify the Rollbar access token, set :rollbar_token, 'your token'" }
42
- set :rollbar_role, Proc.new { :app }
39
+ set :rollbar_user, Proc.new { ENV['USER'] || ENV['USERNAME'] }
40
+ set :rollbar_env, Proc.new { fetch :rails_env, 'production' }
41
+ set :rollbar_token, Proc.new { abort "Please specify the Rollbar access token, set :rollbar_token, 'your token'" }
42
+ set :rollbar_role, Proc.new { :app }
43
+ set :rollbar_revision, Proc.new { fetch :current_revision }
43
44
  end
44
45
  end
@@ -1,3 +1,3 @@
1
1
  module Rollbar
2
- VERSION = "2.3.0"
2
+ VERSION = "2.4.0"
3
3
  end
@@ -1,7 +1,10 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  require File.expand_path('../lib/rollbar/version', __FILE__)
3
3
 
4
+
4
5
  Gem::Specification.new do |gem|
6
+ is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && 'jruby' == RUBY_ENGINE)
7
+
5
8
  gem.authors = ["Rollbar, Inc."]
6
9
  gem.email = ["support@rollbar.com"]
7
10
  gem.description = %q{Easy and powerful exception tracking for Ruby}
@@ -28,5 +31,6 @@ Gem::Specification.new do |gem|
28
31
  gem.add_development_dependency 'delayed_job'
29
32
  gem.add_development_dependency 'rake', '>= 0.9.0'
30
33
  gem.add_development_dependency 'redis'
31
- gem.add_runtime_dependency 'oj', '~> 2.12.14'
34
+ gem.add_runtime_dependency 'multi_json'
35
+ gem.add_development_dependency 'oj', '~> 2.12.14' unless is_jruby
32
36
  end
@@ -1,12 +1,13 @@
1
1
  require 'spec_helper'
2
2
 
3
+
3
4
  describe HomeController do
4
5
  let(:logger_mock) { double("Rails.logger").as_null_object }
5
6
  let(:notifier) { Rollbar.notifier }
6
7
 
7
8
  before do
8
9
  reset_configuration
9
- Rollbar::Rails.initialize
10
+ preconfigure_rails_notifier
10
11
  Rollbar.configure do |config|
11
12
  config.access_token = 'aaaabbbbccccddddeeeeffff00001111'
12
13
  config.logger = logger_mock
@@ -31,7 +32,7 @@ describe HomeController do
31
32
 
32
33
  it 'should use the default "unspecified" environment if rails env ends up being empty' do
33
34
  old_env, ::Rails.env = ::Rails.env, ''
34
- Rollbar::Rails.initialize
35
+ preconfigure_rails_notifier
35
36
 
36
37
  data = Rollbar.notifier.send(:build_payload, 'error', 'message', nil, nil)
37
38
  data['data'][:environment].should == 'unspecified'
@@ -14,7 +14,13 @@ module Delayed
14
14
  end
15
15
 
16
16
  def self.worker
17
- @worker ||= ::Delayed::Worker.new
17
+ prepare_worker unless @worker
18
+
19
+ @worker
20
+ end
21
+
22
+ def self.prepare_worker
23
+ @worker = ::Delayed::Worker.new
18
24
  end
19
25
 
20
26
  class Job
@@ -38,7 +44,7 @@ module Delayed
38
44
  self.attempts = 0
39
45
  self.priority = 0
40
46
  self.id = (self.class.id += 1)
41
- hash.each { |k, v| send(:"#{k}=", v) }
47
+ hash.each { |k, v| send("#{k}=", v) }
42
48
  end
43
49
 
44
50
  def self.all
@@ -1,5 +1,3 @@
1
- require 'rollbar/rails'
2
-
3
1
  Rollbar.configure do |config|
4
2
  config.access_token = 'aaaabbbbccccddddeeeeffff00001111'
5
3
  config.request_timeout = 60
@@ -1,6 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'delayed_job'
3
3
  require 'rollbar/delayed_job'
4
+ require 'delayed/backend/test'
4
5
 
5
6
  describe Rollbar::Delayed, :reconfigure_notifier => true do
6
7
  class FailingJob
@@ -12,9 +13,10 @@ describe Rollbar::Delayed, :reconfigure_notifier => true do
12
13
  end
13
14
 
14
15
  before do
15
- Rollbar::Delayed.wrap_worker
16
- Delayed::Worker.backend = :test
16
+ Delayed::Backend::Test.prepare_worker
17
+ Rollbar::Delayed.wrap_worker!
17
18
 
19
+ Delayed::Worker.backend = :test
18
20
  Delayed::Backend::Test::Job.delete_all
19
21
  end
20
22
 
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ require 'rollbar/json/oj'
4
+
5
+ describe Rollbar::JSON::Oj do
6
+ let(:options) do
7
+ {
8
+ :mode => :compat,
9
+ :use_to_json => false,
10
+ :symbol_keys => false,
11
+ :circular => false
12
+ }
13
+ end
14
+
15
+ it 'returns correct options' do
16
+ expect(described_class.options).to be_eql(options)
17
+ end
18
+ end
@@ -1,43 +1,108 @@
1
1
  require 'spec_helper'
2
+
3
+ require 'multi_json'
2
4
  require 'rollbar/json'
3
5
  require 'rollbar/configuration'
4
6
 
5
- describe Rollbar::JSON do
6
- before do
7
- Rollbar::JSON.setup
7
+ class Rollbar::JSON::MockAdapter
8
+ def self.options
9
+ { 'mock' => 'adapter' }
8
10
  end
11
+ end
9
12
 
10
- let(:payload) do
11
- { :foo => :bar }
13
+ module MultiJson
14
+ module Adapters
15
+ module MockAdapter
16
+ end
12
17
  end
18
+ end
13
19
 
14
- let(:options) do
15
- {
16
- :mode => :compat,
17
- :use_to_json => false,
18
- :symbol_keys => false,
19
- :circular => false
20
- }
20
+ module MultiJson
21
+ module Adapters
22
+ module MissingCustomOptions
23
+ end
21
24
  end
25
+ end
26
+
27
+
28
+ describe Rollbar::JSON do
29
+ let(:payload) do
30
+ { :foo => :bar }
31
+ end
32
+ let(:adapter_options) { { 'option' => 'value' } }
22
33
 
23
34
  describe '.dump' do
24
- it 'has JSON as backend' do
25
- expect(Rollbar::JSON.backend_name).to be_eql(:oj)
35
+ before do
36
+ allow(described_class).to receive(:adapter_options).and_return(adapter_options)
26
37
  end
27
38
 
39
+ it 'calls MultiJson.dump' do
40
+ expect(::MultiJson).to receive(:dump).once.with(payload, adapter_options)
28
41
 
29
- it 'calls JSON.generate' do
30
- expect(::Oj).to receive(:dump).once.with(payload, options)
31
-
32
- Rollbar::JSON.dump(payload)
42
+ described_class.dump(payload)
33
43
  end
34
44
  end
35
45
 
36
46
  describe '.load' do
47
+ before do
48
+ allow(described_class).to receive(:adapter_options).and_return(adapter_options)
49
+ end
50
+
37
51
  it 'calls MultiJson.load' do
38
- expect(::Oj).to receive(:load).once.with(payload, options)
52
+ expect(::MultiJson).to receive(:load).once.with(payload, adapter_options)
53
+
54
+ described_class.load(payload)
55
+ end
56
+ end
57
+
58
+ describe '.with_adapter' do
59
+ let(:object) { double(:foo => 'bar') }
60
+ let(:callback) do
61
+ proc { object.foo }
62
+ end
63
+ let(:adapter) { described_class.detect_multi_json_adapter }
64
+
65
+ it 'calls mock.something with an adapter' do
66
+ expect(MultiJson).to receive(:with_adapter).with(adapter).and_call_original
67
+ expect(object).to receive(:foo).once
68
+
69
+ described_class.with_adapter(&callback)
70
+ end
71
+ end
72
+
73
+ describe '.detect_multi_json_adapter' do
74
+
75
+ end
76
+
77
+ describe '.adapter_options' do
78
+ it 'calls .options in adapter module' do
79
+ expect(described_class.options_module).to receive(:options)
80
+
81
+ described_class.adapter_options
82
+ end
83
+ end
84
+
85
+ describe '.options_module' do
86
+ before { described_class.options_module = nil }
87
+
88
+ context 'with a defined rollbar adapter' do
89
+ let(:expected_adapter) { Rollbar::JSON::MockAdapter }
90
+
91
+ it 'returns the correct options' do
92
+ MultiJson.with_adapter(MultiJson::Adapters::MockAdapter) do
93
+ expect(described_class.options_module).to be(expected_adapter)
94
+ end
95
+ end
96
+ end
97
+
98
+ context 'without a defined rollbar adapter' do
99
+ let(:expected_adapter) { Rollbar::JSON::Default }
39
100
 
40
- Rollbar::JSON.load(payload)
101
+ it 'returns the correct options' do
102
+ MultiJson.with_adapter(MultiJson::Adapters::MissingCustomOptions) do
103
+ expect(described_class.options_module).to be(expected_adapter)
104
+ end
105
+ end
41
106
  end
42
107
  end
43
108
  end
@@ -10,6 +10,21 @@ module NotifierHelpers
10
10
  end
11
11
  end
12
12
 
13
+ def preconfigure_rails_notifier
14
+ rails_logger = if defined?(::Rails.logger)
15
+ ::Rails.logger
16
+ elsif defined?(RAILS_DEFAULT_LOGGER)
17
+ RAILS_DEFAULT_LOGGER
18
+ end
19
+
20
+ Rollbar.preconfigure do |config|
21
+ config.logger = rails_logger
22
+ config.environment = defined?(::Rails.env) && ::Rails.env || defined?(RAILS_ENV) && RAILS_ENV
23
+ config.root = defined?(::Rails.root) && ::Rails.root || defined?(RAILS_ROOT) && RAILS_ROOT
24
+ config.framework = defined?(::Rails.version) && "Rails: #{::Rails.version}" || defined?(::Rails::VERSION::STRING) && "Rails: #{::Rails::VERSION::STRING}"
25
+ end
26
+ end
27
+
13
28
  def test_access_token
14
29
  'bfec94a1ede64984b862880224edd0ed'
15
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rollbar
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rollbar, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-17 00:00:00.000000000 Z
11
+ date: 2015-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -178,6 +178,20 @@ dependencies:
178
178
  - - ">="
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: multi_json
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
181
195
  - !ruby/object:Gem::Dependency
182
196
  name: oj
183
197
  requirement: !ruby/object:Gem::Requirement
@@ -185,7 +199,7 @@ dependencies:
185
199
  - - "~>"
186
200
  - !ruby/object:Gem::Version
187
201
  version: 2.12.14
188
- type: :runtime
202
+ type: :development
189
203
  prerelease: false
190
204
  version_requirements: !ruby/object:Gem::Requirement
191
205
  requirements:
@@ -224,7 +238,6 @@ files:
224
238
  - lib/rollbar.rb
225
239
  - lib/rollbar/active_job.rb
226
240
  - lib/rollbar/active_record_extension.rb
227
- - lib/rollbar/better_errors.rb
228
241
  - lib/rollbar/capistrano.rb
229
242
  - lib/rollbar/capistrano3.rb
230
243
  - lib/rollbar/configuration.rb
@@ -242,6 +255,8 @@ files:
242
255
  - lib/rollbar/exception_reporter.rb
243
256
  - lib/rollbar/goalie.rb
244
257
  - lib/rollbar/json.rb
258
+ - lib/rollbar/json/default.rb
259
+ - lib/rollbar/json/oj.rb
245
260
  - lib/rollbar/logger_proxy.rb
246
261
  - lib/rollbar/middleware/rack/builder.rb
247
262
  - lib/rollbar/middleware/rack/test_session.rb
@@ -337,6 +352,7 @@ files:
337
352
  - spec/rollbar/delayed_job/job_data.rb
338
353
  - spec/rollbar/delayed_job_spec.rb
339
354
  - spec/rollbar/encoding/encoder_spec.rb
355
+ - spec/rollbar/json/oj_spec.rb
340
356
  - spec/rollbar/json_spec.rb
341
357
  - spec/rollbar/logger_proxy_spec.rb
342
358
  - spec/rollbar/middleware/rack/builder_spec.rb
@@ -453,6 +469,7 @@ test_files:
453
469
  - spec/rollbar/delayed_job/job_data.rb
454
470
  - spec/rollbar/delayed_job_spec.rb
455
471
  - spec/rollbar/encoding/encoder_spec.rb
472
+ - spec/rollbar/json/oj_spec.rb
456
473
  - spec/rollbar/json_spec.rb
457
474
  - spec/rollbar/logger_proxy_spec.rb
458
475
  - spec/rollbar/middleware/rack/builder_spec.rb
@@ -1,38 +0,0 @@
1
- require 'better_errors'
2
-
3
- module BetterErrors
4
- class Middleware
5
- alias_method :orig_show_error_page, :show_error_page
6
-
7
- private
8
-
9
- def show_error_page(*args)
10
- exception = @error_page.exception
11
-
12
- env = args.first
13
- exception_data = nil
14
- begin
15
- controller = env['action_controller.instance']
16
- request_data = controller.rollbar_request_data rescue nil
17
- person_data = controller.rollbar_person_data rescue nil
18
- exception_data = Rollbar.scope(:request => request_data, :person => person_data).error(exception, :use_exception_level_filters => true)
19
- rescue => e
20
- Rollbar.log_warning "[Rollbar] Exception while reporting exception to Rollbar: #{e}"
21
- end
22
-
23
- # if an exception was reported, save uuid in the env
24
- # so it can be displayed to the user on the error page
25
- if exception_data.is_a?(Hash)
26
- env['rollbar.exception_uuid'] = exception_data[:uuid]
27
- Rollbar.log_info "[Rollbar] Exception uuid saved in env: #{exception_data[:uuid]}"
28
- elsif exception_data == 'disabled'
29
- Rollbar.log_info "[Rollbar] Exception not reported because Rollbar is disabled"
30
- elsif exception_data == 'ignored'
31
- Rollbar.log_info "[Rollbar] Exception not reported because it was ignored"
32
- end
33
-
34
- # now continue as normal
35
- orig_show_error_page(*args)
36
- end
37
- end
38
- end