rollbar 2.14.1 → 2.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/Gemfile +7 -2
  4. data/README.md +3 -3
  5. data/data/rollbar.snippet.js +1 -1
  6. data/docs/configuration.md +7 -1
  7. data/gemfiles/rails30.gemfile +7 -1
  8. data/gemfiles/rails31.gemfile +5 -1
  9. data/gemfiles/rails32.gemfile +5 -1
  10. data/gemfiles/rails40.gemfile +5 -1
  11. data/gemfiles/rails41.gemfile +5 -1
  12. data/gemfiles/rails42.gemfile +5 -1
  13. data/gemfiles/rails50.gemfile +5 -1
  14. data/gemfiles/ruby_1_8_and_1_9_2.gemfile +4 -2
  15. data/lib/generators/rollbar/rollbar_generator.rb +9 -10
  16. data/lib/rails/rollbar_runner.rb +1 -3
  17. data/lib/rollbar.rb +2 -0
  18. data/lib/rollbar/capistrano3.rb +1 -1
  19. data/lib/rollbar/configuration.rb +7 -7
  20. data/lib/rollbar/delay/girl_friday.rb +0 -1
  21. data/lib/rollbar/delay/sucker_punch.rb +0 -1
  22. data/lib/rollbar/exception_reporter.rb +2 -2
  23. data/lib/rollbar/item.rb +1 -2
  24. data/lib/rollbar/item/frame.rb +1 -1
  25. data/lib/rollbar/json.rb +0 -1
  26. data/lib/rollbar/json/oj.rb +2 -1
  27. data/lib/rollbar/middleware/js.rb +18 -1
  28. data/lib/rollbar/middleware/rails/rollbar.rb +1 -1
  29. data/lib/rollbar/notifier.rb +9 -1
  30. data/lib/rollbar/plugins/goalie.rb +2 -2
  31. data/lib/rollbar/plugins/rails/controller_methods.rb +0 -1
  32. data/lib/rollbar/plugins/rails/railtie32.rb +0 -1
  33. data/lib/rollbar/plugins/sidekiq/plugin.rb +2 -2
  34. data/lib/rollbar/rails.rb +0 -1
  35. data/lib/rollbar/request_data_extractor.rb +6 -4
  36. data/lib/rollbar/truncation.rb +1 -2
  37. data/lib/rollbar/truncation/min_body_strategy.rb +0 -1
  38. data/lib/rollbar/util.rb +5 -10
  39. data/lib/rollbar/version.rb +1 -1
  40. data/lib/tasks/tasks.rake +3 -3
  41. data/rollbar.gemspec +5 -6
  42. data/spec/rollbar/middleware/js_spec.rb +51 -0
  43. data/spec/rollbar_spec.rb +86 -0
  44. metadata +12 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 683163caedab6002fbdf488ed4a8557ce5e659f8
4
- data.tar.gz: 06688bd2b25a4d6fb40ecafca5324138f9493d8a
3
+ metadata.gz: 75de87140e9fe6e01344c22ac625a2726a07cb6a
4
+ data.tar.gz: 4cd6d96381e2c0c6c3af63feb5192ce7cb6523c8
5
5
  SHA512:
6
- metadata.gz: e8002d75652ab7e743924b023f474823ee675030e1ee7a822e1a9c9e1c434cdefb43f90e807eeb54e20a9170d99738fad99874bf395b82e2aa1bb96fac5756ef
7
- data.tar.gz: fa8fc357bc49991914df1016173479f87f7f19509d64ff25b4b5e610ccadf49421597423e93dcf9610ea2fdcdf584530c705d06000dbe8e2caabb729eb850296
6
+ metadata.gz: d913f6a9faf35b2386509f13b5d9bda82e6c9a5e09782cb2623b193ecc3e95fb7e985577e46f4a612b6f2a159c030f48f07f382ff12aeae0a5065d0416a6a251
7
+ data.tar.gz: 32b6fe0ea92ec3e5462f8556fff7c21dc87e7fc058368bee7f3fe6aa40edd9c955dcaae6c0305343048170b307fcc8c8f5d9db9413fe35d6fe50038da85cc578
@@ -1,5 +1,26 @@
1
1
  # Change Log
2
2
 
3
+ ## 2.15.0
4
+
5
+ Features:
6
+
7
+ - Support person data in rollbar.js. See [#602](https://github.com/rollbar/rollbar-gem/pull/602).
8
+ - Update rollbar.js to v2.0.4. See [#600](https://github.com/rollbar/rollbar-gem/pull/600).
9
+ - Add Configuration#use_exception_level_filters option. See [#588](https://github.com/rollbar/rollbar-gem/pull/588).
10
+
11
+ Fixes:
12
+
13
+ - get session from env instead of request. See [#586](https://github.com/rollbar/rollbar-gem/pull/586).
14
+ - If multiple forwarded hosts are present in the headers, use the first. See [#582](https://github.com/rollbar/rollbar-gem/pull/582).
15
+ - Replace present? call with plain ruby alternative. See [#579](https://github.com/rollbar/rollbar-gem/pull/579).
16
+
17
+ Others:
18
+ - Codacy cleanup. See [#599](https://github.com/rollbar/rollbar-gem/pull/599).
19
+ - Remove warning on @root_notifier cause not initialized. See [#562](https://github.com/rollbar/rollbar-gem/pull/562).
20
+ - [Docs] I think you mean this. See [#596](https://github.com/rollbar/rollbar-gem/pull/596).
21
+ - Fix syntax error in code example. See [#581](https://github.com/rollbar/rollbar-gem/pull/581).
22
+
23
+
3
24
  ## 2.14.1
4
25
 
5
26
  - Add host as a configuration options. See [#560](https://github.com/rollbar/rollbar-gem/pull/560).
data/Gemfile CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
- is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && 'jruby' == RUBY_ENGINE)
5
+ is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby')
6
6
 
7
7
  gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
8
8
  gem 'appraisal'
@@ -13,7 +13,12 @@ gem 'rspec-rails', '~> 3.4'
13
13
  gem 'sqlite3', :platform => [:ruby, :mswin, :mingw]
14
14
 
15
15
  gem 'oj', '~> 2.12.14' unless is_jruby
16
- gem 'sidekiq', '>= 2.13.0' if RUBY_VERSION != '1.8.7'
16
+
17
+ if RUBY_VERSION > '1.8.7' && RUBY_VERSION < '2.2.2'
18
+ gem 'sidekiq', '>= 2.13.0', '< 5.0'
19
+ else
20
+ gem 'sidekiq', '>= 2.13.0'
21
+ end
17
22
 
18
23
  platforms :rbx do
19
24
  gem 'minitest'
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Rollbar [![Build Status](https://api.travis-ci.org/rollbar/rollbar-gem.svg?branch=v2.14.1)](https://travis-ci.org/rollbar/rollbar-gem/branches)
1
+ # Rollbar [![Build Status](https://api.travis-ci.org/rollbar/rollbar-gem.svg?branch=v2.15.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.
@@ -115,7 +115,7 @@ end
115
115
  If you disabled the `Rack::Builder` monkey patch or it doesn't work for the Rack framework you are using, then add our Rack middleware to your app:
116
116
 
117
117
  ```ruby
118
- require 'rollbar/middleware/rack
118
+ require 'rollbar/middleware/rack'
119
119
 
120
120
  use Rollbar::Middleware::Rack
121
121
  ```
@@ -313,7 +313,7 @@ class NotificationJob
313
313
  include Sidekiq::Worker
314
314
 
315
315
  def perform(user_id)
316
- Rollbar.scope!(:person => { :id => :user_id })
316
+ Rollbar.scope!(:person => { :id => user_id })
317
317
 
318
318
  # If this next line causes an exception, the reported exception (which will
319
319
  # be reported by Rollbar's standard Sidekiq instrumentation) will also
@@ -1 +1 @@
1
- !function(r){function e(t){if(o[t])return o[t].exports;var n=o[t]={exports:{},id:t,loaded:!1};return r[t].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var o={};return e.m=r,e.c=o,e.p="",e(0)}([function(r,e,o){"use strict";var t=o(1).Rollbar,n=o(2);_rollbarConfig.rollbarJsUrl=_rollbarConfig.rollbarJsUrl||"https://d37gvrvc0wt4s1.cloudfront.net/js/v1.9/rollbar.min.js";var a=t.init(window,_rollbarConfig),i=n(a,_rollbarConfig);a.loadFull(window,document,!_rollbarConfig.async,_rollbarConfig,i)},function(r,e){"use strict";function o(r){return function(){try{return r.apply(this,arguments)}catch(e){try{console.error("[Rollbar]: Internal error",e)}catch(o){}}}}function t(r,e,o){window._rollbarWrappedError&&(o[4]||(o[4]=window._rollbarWrappedError),o[5]||(o[5]=window._rollbarWrappedError._rollbarContext),window._rollbarWrappedError=null),r.uncaughtError.apply(r,o),e&&e.apply(window,o)}function n(r){var e=function(){var e=Array.prototype.slice.call(arguments,0);t(r,r._rollbarOldOnError,e)};return e.belongsToShim=!0,e}function a(r){this.shimId=++c,this.notifier=null,this.parentShim=r,this._rollbarOldOnError=null}function i(r){var e=a;return o(function(){if(this.notifier)return this.notifier[r].apply(this.notifier,arguments);var o=this,t="scope"===r;t&&(o=new e(this));var n=Array.prototype.slice.call(arguments,0),a={shim:o,method:r,args:n,ts:new Date};return window._rollbarShimQueue.push(a),t?o:void 0})}function l(r,e){if(e.hasOwnProperty&&e.hasOwnProperty("addEventListener")){var o=e.addEventListener;e.addEventListener=function(e,t,n){o.call(this,e,r.wrap(t),n)};var t=e.removeEventListener;e.removeEventListener=function(r,e,o){t.call(this,r,e&&e._wrapped?e._wrapped:e,o)}}}var c=0;a.init=function(r,e){var t=e.globalAlias||"Rollbar";if("object"==typeof r[t])return r[t];r._rollbarShimQueue=[],r._rollbarWrappedError=null,e=e||{};var i=new a;return o(function(){if(i.configure(e),e.captureUncaught){i._rollbarOldOnError=r.onerror,r.onerror=n(i);var o,a,c="EventTarget,Window,Node,ApplicationCache,AudioTrackList,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload".split(",");for(o=0;o<c.length;++o)a=c[o],r[a]&&r[a].prototype&&l(i,r[a].prototype)}return e.captureUnhandledRejections&&(i._unhandledRejectionHandler=function(r){var e=r.reason,o=r.promise,t=r.detail;!e&&t&&(e=t.reason,o=t.promise),i.unhandledRejection(e,o)},r.addEventListener("unhandledrejection",i._unhandledRejectionHandler)),r[t]=i,i})()},a.prototype.loadFull=function(r,e,t,n,a){var i=function(){var e;if(void 0===r._rollbarPayloadQueue){var o,t,n,i;for(e=new Error("rollbar.js did not load");o=r._rollbarShimQueue.shift();)for(n=o.args,i=0;i<n.length;++i)if(t=n[i],"function"==typeof t){t(e);break}}"function"==typeof a&&a(e)},l=!1,c=e.createElement("script"),d=e.getElementsByTagName("script")[0],p=d.parentNode;c.crossOrigin="",c.src=n.rollbarJsUrl,c.async=!t,c.onload=c.onreadystatechange=o(function(){if(!(l||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState)){c.onload=c.onreadystatechange=null;try{p.removeChild(c)}catch(r){}l=!0,i()}}),p.insertBefore(c,d)},a.prototype.wrap=function(r,e){try{var o;if(o="function"==typeof e?e:function(){return e||{}},"function"!=typeof r)return r;if(r._isWrap)return r;if(!r._wrapped){r._wrapped=function(){try{return r.apply(this,arguments)}catch(e){throw e._rollbarContext=o()||{},e._rollbarContext._wrappedSource=r.toString(),window._rollbarWrappedError=e,e}},r._wrapped._isWrap=!0;for(var t in r)r.hasOwnProperty(t)&&(r._wrapped[t]=r[t])}return r._wrapped}catch(n){return r}};for(var d="log,debug,info,warn,warning,error,critical,global,configure,scope,uncaughtError,unhandledRejection".split(","),p=0;p<d.length;++p)a.prototype[d[p]]=i(d[p]);r.exports={Rollbar:a,_rollbarWindowOnError:t}},function(r,e){"use strict";r.exports=function(r,e){return function(o){if(!o&&!window._rollbarInitialized){var t=window.RollbarNotifier,n=e||{},a=n.globalAlias||"Rollbar",i=window.Rollbar.init(n,r);i._processShimQueue(window._rollbarShimQueue||[]),window[a]=i,window._rollbarInitialized=!0,t.processPayloads()}}}}]);
1
+ !function(r){function o(e){if(n[e])return n[e].exports;var t=n[e]={exports:{},id:e,loaded:!1};return r[e].call(t.exports,t,t.exports,o),t.loaded=!0,t.exports}var n={};return o.m=r,o.c=n,o.p="",o(0)}([function(r,o,n){"use strict";var e=n(1),t=n(4);_rollbarConfig=_rollbarConfig||{},_rollbarConfig.rollbarJsUrl=_rollbarConfig.rollbarJsUrl||"https://cdnjs.cloudflare.com/ajax/libs/rollbar.js/2.0.4/rollbar.min.js",_rollbarConfig.async=void 0===_rollbarConfig.async||_rollbarConfig.async;var a=e.setupShim(window,_rollbarConfig),l=t(_rollbarConfig);window.rollbar=e.Rollbar,a.loadFull(window,document,!_rollbarConfig.async,_rollbarConfig,l)},function(r,o,n){"use strict";function e(r){return function(){try{return r.apply(this,arguments)}catch(r){try{console.error("[Rollbar]: Internal error",r)}catch(r){}}}}function t(r,o){this.options=r,this._rollbarOldOnError=null;var n=s++;this.shimId=function(){return n},window&&window._rollbarShims&&(window._rollbarShims[n]={handler:o,messages:[]})}function a(r,o){var n=o.globalAlias||"Rollbar";if("object"==typeof r[n])return r[n];r._rollbarShims={},r._rollbarWrappedError=null;var t=new d(o);return e(function(){return o.captureUncaught&&(t._rollbarOldOnError=r.onerror,i.captureUncaughtExceptions(r,t,!0),i.wrapGlobals(r,t,!0)),o.captureUnhandledRejections&&i.captureUnhandledRejections(r,t,!0),r[n]=t,t})()}function l(r){return e(function(){var o=this,n=Array.prototype.slice.call(arguments,0),e={shim:o,method:r,args:n,ts:new Date};window._rollbarShims[this.shimId()].messages.push(e)})}var i=n(2),s=0,c=n(3),p=function(r,o){return new t(r,o)},d=c.bind(null,p);t.prototype.loadFull=function(r,o,n,t,a){var l=function(){var o;if(void 0===r._rollbarDidLoad){o=new Error("rollbar.js did not load");for(var n,e,t,l,i=0;n=r._rollbarShims[i++];)for(n=n.messages||[];e=n.shift();)for(t=e.args||[],i=0;i<t.length;++i)if(l=t[i],"function"==typeof l){l(o);break}}"function"==typeof a&&a(o)},i=!1,s=o.createElement("script"),c=o.getElementsByTagName("script")[0],p=c.parentNode;s.crossOrigin="",s.src=t.rollbarJsUrl,n||(s.async=!0),s.onload=s.onreadystatechange=e(function(){if(!(i||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState)){s.onload=s.onreadystatechange=null;try{p.removeChild(s)}catch(r){}i=!0,l()}}),p.insertBefore(s,c)},t.prototype.wrap=function(r,o){try{var n;if(n="function"==typeof o?o:function(){return o||{}},"function"!=typeof r)return r;if(r._isWrap)return r;if(!r._wrapped&&(r._wrapped=function(){try{return r.apply(this,arguments)}catch(e){var o=e;throw"string"==typeof o&&(o=new String(o)),o._rollbarContext=n()||{},o._rollbarContext._wrappedSource=r.toString(),window._rollbarWrappedError=o,o}},r._wrapped._isWrap=!0,r.hasOwnProperty))for(var e in r)r.hasOwnProperty(e)&&(r._wrapped[e]=r[e]);return r._wrapped}catch(o){return r}};for(var u="log,debug,info,warn,warning,error,critical,global,configure,handleUncaughtException,handleUnhandledRejection".split(","),f=0;f<u.length;++f)t.prototype[u[f]]=l(u[f]);r.exports={setupShim:a,Rollbar:d}},function(r,o){"use strict";function n(r,o,n){if(r){var t;"function"==typeof o._rollbarOldOnError?t=o._rollbarOldOnError:r.onerror&&!r.onerror.belongsToShim&&(t=r.onerror,o._rollbarOldOnError=t);var a=function(){var n=Array.prototype.slice.call(arguments,0);e(r,o,t,n)};a.belongsToShim=n,r.onerror=a}}function e(r,o,n,e){r._rollbarWrappedError&&(e[4]||(e[4]=r._rollbarWrappedError),e[5]||(e[5]=r._rollbarWrappedError._rollbarContext),r._rollbarWrappedError=null),o.handleUncaughtException.apply(o,e),n&&n.apply(r,e)}function t(r,o,n){if(r){"function"==typeof r._rollbarURH&&r._rollbarURH.belongsToShim&&r.removeEventListener("unhandledrejection",r._rollbarURH);var e=function(r){var n=r.reason,e=r.promise,t=r.detail;!n&&t&&(n=t.reason,e=t.promise),o&&o.handleUnhandledRejection&&o.handleUnhandledRejection(n,e)};e.belongsToShim=n,r._rollbarURH=e,r.addEventListener("unhandledrejection",e)}}function a(r,o,n){if(r){var e,t,a="EventTarget,Window,Node,ApplicationCache,AudioTrackList,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload".split(",");for(e=0;e<a.length;++e)t=a[e],r[t]&&r[t].prototype&&l(o,r[t].prototype,n)}}function l(r,o,n){if(o.hasOwnProperty&&o.hasOwnProperty("addEventListener")){for(var e=o.addEventListener;e._rollbarOldAdd&&e.belongsToShim;)e=e._rollbarOldAdd;var t=function(o,n,t){e.call(this,o,r.wrap(n),t)};t._rollbarOldAdd=e,t.belongsToShim=n,o.addEventListener=t;for(var a=o.removeEventListener;a._rollbarOldRemove&&a.belongsToShim;)a=a._rollbarOldRemove;var l=function(r,o,n){a.call(this,r,o&&o._wrapped||o,n)};l._rollbarOldRemove=a,l.belongsToShim=n,o.removeEventListener=l}}r.exports={captureUncaughtExceptions:n,captureUnhandledRejections:t,wrapGlobals:a}},function(r,o){"use strict";function n(r,o){this.impl=r(o,this),this.options=o,e(n.prototype)}function e(r){for(var o=function(r){return function(){var o=Array.prototype.slice.call(arguments,0);if(this.impl[r])return this.impl[r].apply(this.impl,o)}},n="log,debug,info,warn,warning,error,critical,global,configure,handleUncaughtException,handleUnhandledRejection,_createItem,wrap,loadFull,shimId".split(","),e=0;e<n.length;e++)r[n[e]]=o(n[e])}n.prototype._swapAndProcessMessages=function(r,o){this.impl=r(this.options);for(var n,e,t;n=o.shift();)e=n.method,t=n.args,this[e]&&"function"==typeof this[e]&&this[e].apply(this,t);return this},r.exports=n},function(r,o){"use strict";r.exports=function(r){return function(o){if(!o&&!window._rollbarInitialized){r=r||{};for(var n,e,t=r.globalAlias||"Rollbar",a=window.rollbar,l=function(r){return new a(r)},i=0;n=window._rollbarShims[i++];)e||(e=n.handler),n.handler._swapAndProcessMessages(l,n.messages);window[t]=e,window._rollbarInitialized=!0}}}}]);
@@ -217,7 +217,7 @@ Sets the number of retries cause timeouts on the POST request.
217
217
  ### root
218
218
 
219
219
  Set the server root, all stack frames outside that root are considered
220
- 'non-project' frames. Also used to setup Github linking.
220
+ 'non-project' frames. Also used to setup GitHub linking.
221
221
 
222
222
  ### safely
223
223
 
@@ -294,6 +294,12 @@ installed, uses `girl_friday`, otherwise defaults to `Thread`.
294
294
  When `true` indicates you wish to send data to Rollbar with `eventmachine`.
295
295
  Won't work unless `eventmachine` is installed.
296
296
 
297
+ ### use_exception_level_filters_default
298
+
299
+ **Default** `false`
300
+
301
+ When `true` the notifier will use the `exception_level_filters` when reporting. It can be overriden using `:use_exception_level_filters` option. see [Exception level filters](https://github.com/rollbar/rollbar-gem#exception-level-filters)
302
+
297
303
  ### web_base
298
304
 
299
305
  **Default** `'https://rollbar.com'`
@@ -15,7 +15,13 @@ gem 'rspec-rails', '>= 2.14.0'
15
15
  gem 'celluloid', '< 0.17.0' if RUBY_VERSION == '1.9.2'
16
16
 
17
17
  gem 'oj', '~> 2.12.14' unless is_jruby
18
- gem 'sidekiq', '>= 2.13.0' if RUBY_VERSION != '1.8.7'
18
+ if RUBY_VERSION > '1.8.7'
19
+ if RUBY_VERSION < '2.2.2'
20
+ gem 'sidekiq', '>= 2.13.0', '< 5.0'
21
+ else
22
+ gem 'sidekiq', '>= 2.13.0'
23
+ end
24
+ end
19
25
 
20
26
  platforms :rbx do
21
27
  gem 'minitest'
@@ -43,7 +43,11 @@ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.0')
43
43
  gem 'sidekiq', '< 2.13.0'
44
44
  else
45
45
  gem 'webmock', :require => false
46
- gem 'sidekiq', '>= 2.13.0'
46
+ if RUBY_VERSION < '2.2.2'
47
+ gem 'sidekiq', '>= 2.13.0', '< 5.0'
48
+ else
49
+ gem 'sidekiq', '>= 2.13.0'
50
+ end
47
51
  end
48
52
 
49
53
  gem 'resque'
@@ -15,7 +15,11 @@ gem 'sqlite3', :platform => [:ruby, :mswin, :mingw]
15
15
  gem 'test-unit'
16
16
 
17
17
  gem 'oj', '~> 2.12.14' unless is_jruby
18
- gem 'sidekiq', '>= 2.13.0' if RUBY_VERSION != '1.8.7'
18
+ if RUBY_VERSION > '1.8.7' && RUBY_VERSION < '2.2.2'
19
+ gem 'sidekiq', '>= 2.13.0', '< 5.0'
20
+ else
21
+ gem 'sidekiq', '>= 2.13.0'
22
+ end
19
23
 
20
24
  platforms :rbx do
21
25
  gem 'minitest'
@@ -15,7 +15,11 @@ gem 'sqlite3', :platform => [:ruby, :mswin, :mingw]
15
15
  gem 'test-unit'
16
16
 
17
17
  gem 'oj', '~> 2.12.14' unless is_jruby
18
- gem 'sidekiq', '>= 2.13.0' if RUBY_VERSION != '1.8.7'
18
+ if RUBY_VERSION > '1.8.7' && RUBY_VERSION < '2.2.2'
19
+ gem 'sidekiq', '>= 2.13.0', '< 5.0'
20
+ else
21
+ gem 'sidekiq', '>= 2.13.0'
22
+ end
19
23
 
20
24
  platforms :rbx do
21
25
  gem 'minitest'
@@ -13,7 +13,11 @@ gem 'rspec-rails', '~> 3.4'
13
13
  gem 'sqlite3', :platform => [:ruby, :mswin, :mingw]
14
14
 
15
15
  gem 'oj', '~> 2.12.14' unless is_jruby
16
- gem 'sidekiq', '>= 2.13.0' if RUBY_VERSION != '1.8.7'
16
+ if RUBY_VERSION > '1.8.7' && RUBY_VERSION < '2.2.2'
17
+ gem 'sidekiq', '>= 2.13.0', '< 5.0'
18
+ else
19
+ gem 'sidekiq', '>= 2.13.0'
20
+ end
17
21
 
18
22
  platforms :rbx do
19
23
  gem 'minitest'
@@ -13,7 +13,11 @@ gem 'rake'
13
13
  gem 'rspec-rails', '~> 3.4'
14
14
  gem 'sqlite3', :platform => [:ruby, :mswin, :mingw]
15
15
 
16
- gem 'sidekiq', '>= 2.13.0' if RUBY_VERSION != '1.8.7'
16
+ if RUBY_VERSION > '1.8.7' && RUBY_VERSION < '2.2.2'
17
+ gem 'sidekiq', '>= 2.13.0', '< 5.0'
18
+ else
19
+ gem 'sidekiq', '>= 2.13.0'
20
+ end
17
21
 
18
22
  platforms :rbx do
19
23
  gem 'minitest'
@@ -19,7 +19,11 @@ gem 'rspec-mocks', '~> 3.5.0.beta3'
19
19
  gem 'rake'
20
20
 
21
21
  gem 'oj', '~> 2.12.14' unless is_jruby
22
- gem 'sidekiq', '>= 2.13.0' if RUBY_VERSION != '1.8.7'
22
+ if RUBY_VERSION > '1.8.7' && RUBY_VERSION < '2.2.2'
23
+ gem 'sidekiq', '>= 2.13.0', '< 5.0'
24
+ else
25
+ gem 'sidekiq', '>= 2.13.0'
26
+ end
23
27
 
24
28
  platforms :rbx do
25
29
  gem 'minitest'
@@ -6,7 +6,6 @@ is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && 'jruby' == RUBY_
6
6
 
7
7
  gem 'appraisal', '= 1.0.2'
8
8
  gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
9
- gem 'celluloid', '< 0.17.0' if RUBY_VERSION == '1.9.2'
10
9
  gem 'hitimes', '< 1.2.2'
11
10
  gem 'jruby-openssl', :platform => :jruby
12
11
  gem 'rails', '3.0.20'
@@ -15,7 +14,9 @@ gem 'rspec-rails', '>= 2.14.0'
15
14
  gem 'sqlite3', :platform => [:ruby, :mswin, :mingw]
16
15
 
17
16
  gem 'oj', '~> 2.12.14' unless is_jruby
18
- gem 'sidekiq', '>= 2.13.0' if RUBY_VERSION != '1.8.7'
17
+ if RUBY_VERSION > '1.8.7' && RUBY_VERSION < '2.2.2'
18
+ gem 'sidekiq', '>= 2.13.0', '< 5.0'
19
+ end
19
20
 
20
21
  platforms :rbx do
21
22
  gem 'minitest'
@@ -25,6 +26,7 @@ platforms :rbx do
25
26
  end
26
27
 
27
28
  if RUBY_VERSION.start_with?('1.9')
29
+ gem 'celluloid', '< 0.17.0'
28
30
  gem 'sucker_punch', '~> 1.0'
29
31
  elsif RUBY_VERSION.start_with?('2')
30
32
  gem 'sucker_punch', '~> 2.0'
@@ -10,10 +10,10 @@ module Rollbar
10
10
  source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
11
11
 
12
12
  def create_initializer
13
- say "creating initializer..."
13
+ say 'creating initializer...'
14
14
  if access_token_configured?
15
15
  say "It looks like you've already configured Rollbar."
16
- say "To re-create the config file, remove it first: config/initializers/rollbar.rb"
16
+ say 'To re-create the config file, remove it first: config/initializers/rollbar.rb'
17
17
  exit
18
18
  end
19
19
 
@@ -21,27 +21,26 @@ module Rollbar
21
21
  require 'ey_config'
22
22
  rescue LoadError
23
23
  end
24
-
24
+
25
25
  if defined? EY::Config
26
- say "Access token will be read from Engine Yard configuration"
26
+ say 'Access token will be read from Engine Yard configuration'
27
27
  else
28
28
  if access_token === :use_env_sentinel
29
- say "Generator run without an access token; assuming you want to configure using an environment variable."
29
+ say 'Generator run without an access token; assuming you want to configure using an environment variable.'
30
30
  say "You'll need to add an environment variable ROLLBAR_ACCESS_TOKEN with your access token:"
31
31
  say "\n$ export ROLLBAR_ACCESS_TOKEN=yourtokenhere"
32
32
  say "\nIf that's not what you wanted to do:"
33
33
  say "\n$ rm config/initializers/rollbar.rb"
34
- say "$ rails generate rollbar yourtokenhere"
34
+ say '$ rails generate rollbar yourtokenhere'
35
35
  say "\n"
36
36
  else
37
- say "access token: " << access_token
37
+ say 'access token: ' << access_token
38
38
  end
39
39
  end
40
40
 
41
- template 'initializer.rb', 'config/initializers/rollbar.rb',
42
- :assigns => { :access_token => access_token_expr }
41
+ template 'initializer.rb', 'config/initializers/rollbar.rb', :assigns => { :access_token => access_token_expr }
43
42
 
44
- # TODO run rake test task
43
+ # TODO: run rake test task
45
44
  end
46
45
 
47
46
  def access_token_expr
@@ -38,7 +38,7 @@ module Rails
38
38
  def eval_runner
39
39
  string_to_eval = File.read(runner_path)
40
40
 
41
- ::Rails.module_eval(<<-EOL,__FILE__,__LINE__ + 2)
41
+ ::Rails.module_eval(<<-EOL, __FILE__, __LINE__ + 2)
42
42
  #{string_to_eval}
43
43
  EOL
44
44
  end
@@ -68,5 +68,3 @@ module Rails
68
68
  end
69
69
  end
70
70
  end
71
-
72
-
@@ -190,6 +190,8 @@ module Rollbar
190
190
  end
191
191
  end
192
192
  end
193
+
194
+ self.root_notifier = nil
193
195
  end
194
196
 
195
197
  Rollbar.plugins.require_all
@@ -1 +1 @@
1
- load File.expand_path("../tasks/rollbar.cap", __FILE__)
1
+ load File.expand_path('../tasks/rollbar.cap', __FILE__)
@@ -55,6 +55,7 @@ module Rollbar
55
55
  attr_accessor :web_base
56
56
  attr_accessor :write_to_file
57
57
  attr_reader :send_extra_frame_data
58
+ attr_accessor :use_exception_level_filters_default
58
59
 
59
60
  attr_reader :project_gem_paths
60
61
 
@@ -74,7 +75,7 @@ module Rollbar
74
75
  @disable_core_monkey_patch = false
75
76
  @disable_rack_monkey_patch = false
76
77
  @dj_threshold = 0
77
- @enabled = nil # set to true when configure is called
78
+ @enabled = nil # set to true when configure is called
78
79
  @endpoint = DEFAULT_ENDPOINT
79
80
  @environment = nil
80
81
  @exception_level_filters = {
@@ -100,7 +101,7 @@ module Rollbar
100
101
  @js_options = {}
101
102
  @scrub_fields = [:passwd, :password, :password_confirmation, :secret,
102
103
  :confirm_password, :password_confirmation, :secret_token,
103
- :api_key, :access_token ]
104
+ :api_key, :access_token]
104
105
  @scrub_user = true
105
106
  @scrub_password = true
106
107
  @randomize_scrub_length = true
@@ -116,6 +117,7 @@ module Rollbar
116
117
  @write_to_file = false
117
118
  @send_extra_frame_data = :none
118
119
  @project_gem_paths = []
120
+ @use_exception_level_filters_default = false
119
121
  end
120
122
 
121
123
  def initialize_copy(orig)
@@ -170,7 +172,7 @@ module Rollbar
170
172
  end
171
173
 
172
174
  def use_sidekiq=(value)
173
- deprecation_message = "#use_sidekiq=(value) has been deprecated in favor of #use_sidekiq(options = {}). Please update your rollbar configuration."
175
+ deprecation_message = '#use_sidekiq=(value) has been deprecated in favor of #use_sidekiq(options = {}). Please update your rollbar configuration.'
174
176
  defined?(ActiveSupport) ? ActiveSupport::Deprecation.warn(deprecation_message) : puts(deprecation_message)
175
177
 
176
178
  value.is_a?(Hash) ? use_sidekiq(value) : use_sidekiq
@@ -189,7 +191,7 @@ module Rollbar
189
191
  end
190
192
 
191
193
  def use_sucker_punch=(value)
192
- deprecation_message = "#use_sucker_punch=(value) has been deprecated in favor of #use_sucker_punch. Please update your rollbar configuration."
194
+ deprecation_message = '#use_sucker_punch=(value) has been deprecated in favor of #use_sucker_punch. Please update your rollbar configuration.'
193
195
  defined?(ActiveSupport) ? ActiveSupport::Deprecation.warn(deprecation_message) : puts(deprecation_message)
194
196
 
195
197
  use_sucker_punch
@@ -203,9 +205,7 @@ module Rollbar
203
205
  def project_gems=(gems)
204
206
  @project_gem_paths = gems.map do |name|
205
207
  found = Gem::Specification.each.select { |spec| name === spec.name }
206
- if found.empty?
207
- puts "[Rollbar] No gems found matching #{name.inspect}"
208
- end
208
+ puts "[Rollbar] No gems found matching #{name.inspect}" if found.empty?
209
209
  found
210
210
  end.flatten.uniq.map(&:gem_dir)
211
211
  end
@@ -1,7 +1,6 @@
1
1
  module Rollbar
2
2
  module Delay
3
3
  class GirlFriday
4
-
5
4
  class << self
6
5
  def queue_class
7
6
  ::GirlFriday::WorkQueue
@@ -4,7 +4,6 @@ require 'sucker_punch/version'
4
4
  module Rollbar
5
5
  module Delay
6
6
  class SuckerPunch
7
-
8
7
  include ::SuckerPunch::Job
9
8
 
10
9
  class << self
@@ -10,9 +10,9 @@ module Rollbar
10
10
  env['rollbar.exception_uuid'] = exception_data[:uuid]
11
11
  Rollbar.log_debug "[Rollbar] Exception uuid saved in env: #{exception_data[:uuid]}"
12
12
  elsif exception_data == 'disabled'
13
- Rollbar.log_debug "[Rollbar] Exception not reported because Rollbar is disabled"
13
+ Rollbar.log_debug '[Rollbar] Exception not reported because Rollbar is disabled'
14
14
  elsif exception_data == 'ignored'
15
- Rollbar.log_debug "[Rollbar] Exception not reported because it was ignored"
15
+ Rollbar.log_debug '[Rollbar] Exception not reported because it was ignored'
16
16
  end
17
17
  rescue => e
18
18
  Rollbar.log_warning "[Rollbar] Exception while reporting exception to Rollbar: #{e.message}"
@@ -147,8 +147,7 @@ module Rollbar
147
147
  backtrace = Backtrace.new(exception,
148
148
  :message => message,
149
149
  :extra => build_extra,
150
- :configuration => configuration
151
- )
150
+ :configuration => configuration)
152
151
 
153
152
  backtrace.to_h
154
153
  end
@@ -105,7 +105,7 @@ module Rollbar
105
105
  to_line = lineno - 2
106
106
  from_line = [to_line - MAX_CONTEXT_LENGTH + 1, 0].max
107
107
 
108
- file_lines[from_line, (to_line - from_line + 1)].select(&:present?)
108
+ file_lines[from_line, (to_line - from_line + 1)].select { |line| line && !line.empty? }
109
109
  end
110
110
  end
111
111
  end
@@ -63,4 +63,3 @@ module Rollbar
63
63
  end
64
64
  end
65
65
  end
66
-
@@ -4,7 +4,8 @@ module Rollbar
4
4
  extend self
5
5
 
6
6
  def options
7
- { :mode=> :compat,
7
+ {
8
+ :mode => :compat,
8
9
  :use_to_json => false,
9
10
  :symbol_keys => false,
10
11
  :circular => false
@@ -1,10 +1,14 @@
1
1
  require 'rack'
2
2
  require 'rack/response'
3
3
 
4
+ require 'rollbar/request_data_extractor'
5
+
4
6
  module Rollbar
5
7
  module Middleware
6
8
  # Middleware to inject the rollbar.js snippet into a 200 html response
7
9
  class Js
10
+ include Rollbar::RequestDataExtractor
11
+
8
12
  attr_reader :app
9
13
  attr_reader :config
10
14
 
@@ -103,7 +107,20 @@ module Rollbar
103
107
  end
104
108
 
105
109
  def config_js_tag(env)
106
- script_tag("var _rollbarConfig = #{config[:options].to_json};", env)
110
+ js_config = config[:options].dup
111
+
112
+ add_person_data(js_config, env)
113
+
114
+ script_tag("var _rollbarConfig = #{js_config.to_json};", env)
115
+ end
116
+
117
+ def add_person_data(js_config, env)
118
+ person_data = extract_person_data_from_controller(env)
119
+
120
+ return if person_data && person_data.empty?
121
+
122
+ js_config[:payload] ||= {}
123
+ js_config[:payload][:person] = person_data if person_data
107
124
  end
108
125
 
109
126
  def snippet_js_tag(env)
@@ -60,7 +60,7 @@ module Rollbar
60
60
 
61
61
  def person_data_proc(env)
62
62
  block = proc { extract_person_data_from_controller(env) }
63
- return block unless(defined?(ActiveRecord::Base) && ActiveRecord::Base.connected?)
63
+ return block unless defined?(ActiveRecord::Base) && ActiveRecord::Base.connected?
64
64
 
65
65
  proc { ActiveRecord::Base.connection_pool.with_connection(&block) }
66
66
  end
@@ -123,7 +123,7 @@ module Rollbar
123
123
  return 'disabled' unless configuration.enabled
124
124
 
125
125
  message, exception, extra = extract_arguments(args)
126
- use_exception_level_filters = extra && extra.delete(:use_exception_level_filters) == true
126
+ use_exception_level_filters = use_exception_level_filters?(extra)
127
127
 
128
128
  return 'ignored' if ignored?(exception, use_exception_level_filters)
129
129
 
@@ -291,6 +291,14 @@ module Rollbar
291
291
 
292
292
  private
293
293
 
294
+ def use_exception_level_filters?(options)
295
+ option_value = options && options.delete(:use_exception_level_filters)
296
+
297
+ return option_value unless option_value.nil?
298
+
299
+ configuration.use_exception_level_filters_default
300
+ end
301
+
294
302
  def call_before_process(options)
295
303
  options = {
296
304
  :level => options[:level],
@@ -23,9 +23,9 @@ Rollbar.plugins.define('goalie') do
23
23
  env['rollbar.exception_uuid'] = exception_data[:uuid]
24
24
  Rollbar.log_info "[Rollbar] Exception uuid saved in env: #{exception_data[:uuid]}"
25
25
  elsif exception_data == 'disabled'
26
- Rollbar.log_info "[Rollbar] Exception not reported because Rollbar is disabled"
26
+ Rollbar.log_info '[Rollbar] Exception not reported because Rollbar is disabled'
27
27
  elsif exception_data == 'ignored'
28
- Rollbar.log_info "[Rollbar] Exception not reported because it was ignored"
28
+ Rollbar.log_info '[Rollbar] Exception not reported because it was ignored'
29
29
  end
30
30
 
31
31
  # now continue as normal
@@ -34,7 +34,6 @@ module Rollbar
34
34
  def ratchetio_request_data
35
35
  rollbar_request_data
36
36
  end
37
-
38
37
  end
39
38
  end
40
39
  end
@@ -15,4 +15,3 @@ module Rollbar
15
15
  end
16
16
  end
17
17
  end
18
-
@@ -39,8 +39,8 @@ module Rollbar
39
39
  end
40
40
 
41
41
  def self.skip_report?(msg_or_context, e)
42
- msg_or_context.is_a?(Hash) && msg_or_context["retry"] &&
43
- msg_or_context["retry_count"] && msg_or_context["retry_count"] < ::Rollbar.configuration.sidekiq_threshold
42
+ msg_or_context.is_a?(Hash) && msg_or_context['retry'] &&
43
+ msg_or_context['retry_count'] && msg_or_context['retry_count'] < ::Rollbar.configuration.sidekiq_threshold
44
44
  end
45
45
 
46
46
  def call(worker, msg, queue)
@@ -1,5 +1,4 @@
1
1
  module Rollbar
2
2
  module Rails
3
-
4
3
  end
5
4
  end
@@ -31,7 +31,7 @@ module Rollbar
31
31
  post_params = scrub_params(rollbar_post_params(rack_req), sensitive_params)
32
32
  raw_body_params = scrub_params(mergeable_raw_body_params(rack_req), sensitive_params)
33
33
  cookies = scrub_params(rollbar_request_cookies(rack_req), sensitive_params)
34
- session = scrub_params(rollbar_request_session(rack_req), sensitive_params)
34
+ session = scrub_params(rollbar_request_session(env), sensitive_params)
35
35
  route_params = scrub_params(rollbar_route_params(env), sensitive_params)
36
36
 
37
37
  url = scrub_url(rollbar_url(env), sensitive_params)
@@ -112,7 +112,9 @@ module Rollbar
112
112
  forwarded_proto = env['HTTP_X_FORWARDED_PROTO'] || env['rack.url_scheme'] || ''
113
113
  scheme = forwarded_proto.split(',').first
114
114
 
115
- host = env['HTTP_X_FORWARDED_HOST'] || env['HTTP_HOST'] || env['SERVER_NAME']
115
+ forwarded_host = env['HTTP_X_FORWARDED_HOST'] || env['HTTP_HOST'] || env['SERVER_NAME']
116
+ host = forwarded_host && forwarded_host.split(',').first.strip
117
+
116
118
  path = env['ORIGINAL_FULLPATH'] || env['REQUEST_URI']
117
119
  unless path.nil? || path.empty?
118
120
  path = '/' + path.to_s if path.to_s.slice(0, 1) != '/'
@@ -201,8 +203,8 @@ module Rollbar
201
203
  end
202
204
  end
203
205
 
204
- def rollbar_request_session(rack_req)
205
- session = rack_req.session
206
+ def rollbar_request_session(env)
207
+ session = env.fetch('rack.session', {})
206
208
 
207
209
  session.to_hash
208
210
  rescue
@@ -13,8 +13,7 @@ module Rollbar
13
13
  STRATEGIES = [RawStrategy,
14
14
  FramesStrategy,
15
15
  StringsStrategy,
16
- MinBodyStrategy
17
- ]
16
+ MinBodyStrategy]
18
17
 
19
18
  def self.truncate(payload)
20
19
  result = nil
@@ -22,7 +22,6 @@ module Rollbar
22
22
  body['trace'] = truncate_trace_data(body['trace'])
23
23
  end
24
24
 
25
-
26
25
  dump(new_payload)
27
26
  end
28
27
 
@@ -1,6 +1,5 @@
1
1
  require 'rollbar/util/hash'
2
2
 
3
-
4
3
  module Rollbar
5
4
  module Util
6
5
  def self.iterate_and_update(obj, block)
@@ -28,9 +27,7 @@ module Rollbar
28
27
  obj[k] = block.call(v)
29
28
  end
30
29
 
31
- if new_key != k
32
- key_updates.push([k, new_key])
33
- end
30
+ key_updates.push([k, new_key]) if new_key != k
34
31
  end
35
32
 
36
33
  key_updates.each do |old_key, new_key|
@@ -53,12 +50,12 @@ module Rollbar
53
50
  def self.deep_copy(obj)
54
51
  if obj.is_a?(::Hash)
55
52
  result = obj.clone
56
- obj.each {|k, v| result[k] = deep_copy(v)}
53
+ obj.each { |k, v| result[k] = deep_copy(v)}
57
54
  result
58
55
  elsif obj.is_a?(Array)
59
56
  result = obj.clone
60
57
  result.clear
61
- obj.each {|v| result << deep_copy(v)}
58
+ obj.each { |v| result << deep_copy(v)}
62
59
  result
63
60
  else
64
61
  obj
@@ -85,11 +82,9 @@ module Rollbar
85
82
  def self.truncate(str, length)
86
83
  ellipsis = '...'
87
84
 
88
- if str.length <= length or str.length <= ellipsis.length
89
- return str
90
- end
85
+ return str if str.length <= length || str.length <= ellipsis.length
91
86
 
92
- str.unpack("U*").slice(0, length - ellipsis.length).pack("U*") + ellipsis
87
+ str.unpack('U*').slice(0, length - ellipsis.length).pack('U*') + ellipsis
93
88
  end
94
89
 
95
90
  def self.uuid_rollbar_url(data, configuration)
@@ -1,3 +1,3 @@
1
1
  module Rollbar
2
- VERSION = '2.14.1'
2
+ VERSION = '2.15.0'
3
3
  end
@@ -2,9 +2,9 @@ require 'fileutils'
2
2
 
3
3
  desc 'Update rollbar.js snippet'
4
4
  task :update_snippet do
5
- input_path = File.expand_path("../../../rollbar.js/dist/rollbar.snippet.js", __FILE__)
6
- output_path = File.expand_path("../../../data/rollbar.snippet.js", __FILE__)
7
- output_dir = File.expand_path("../../../data/", __FILE__)
5
+ input_path = File.expand_path('../../../rollbar.js/dist/rollbar.snippet.js', __FILE__)
6
+ output_path = File.expand_path('../../../data/rollbar.snippet.js', __FILE__)
7
+ output_dir = File.expand_path('../../../data/', __FILE__)
8
8
 
9
9
  $stdout.write("Copying #{input_path} to #{output_path}\n")
10
10
 
@@ -1,22 +1,21 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  require File.expand_path('../lib/rollbar/version', __FILE__)
3
3
 
4
-
5
4
  Gem::Specification.new do |gem|
6
5
  is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && 'jruby' == RUBY_ENGINE)
7
6
 
8
- gem.authors = ["Rollbar, Inc."]
9
- gem.email = ["support@rollbar.com"]
7
+ gem.authors = ['Rollbar, Inc.']
8
+ gem.email = ['support@rollbar.com']
10
9
  gem.description = %q{Easy and powerful exception tracking for Ruby}
11
10
  gem.executables = ['rollbar-rails-runner']
12
11
  gem.summary = %q{Reports exceptions to Rollbar}
13
- gem.homepage = "https://rollbar.com"
12
+ gem.homepage = 'https://rollbar.com'
14
13
  gem.license = 'MIT'
15
14
 
16
15
  gem.files = `git ls-files`.split($\)
17
16
  gem.test_files = gem.files.grep(%r{^(spec)/})
18
- gem.name = "rollbar"
19
- gem.require_paths = ["lib"]
17
+ gem.name = 'rollbar'
18
+ gem.require_paths = ['lib']
20
19
  gem.version = Rollbar::VERSION
21
20
 
22
21
  gem.add_runtime_dependency 'multi_json'
@@ -230,6 +230,57 @@ END
230
230
  allow(subject).to receive(:add_js).and_raise(StandardError.new)
231
231
  end
232
232
  end
233
+
234
+ context 'with person data' do
235
+ let(:body) { [html] }
236
+ let(:status) { 200 }
237
+ let(:headers) do
238
+ { 'Content-Type' => content_type }
239
+ end
240
+ let(:env) do
241
+ {
242
+ 'rollbar.person_data' => {
243
+ :id => 100,
244
+ :username => 'foo',
245
+ :email => 'foo@bar.com'
246
+ }
247
+ }
248
+ end
249
+ let(:expected_js_options) do
250
+ {
251
+ :foo => :bar,
252
+ :payload => {
253
+ :person => {
254
+ :id => 100,
255
+ :username => 'foo',
256
+ :email => 'foo@bar.com'
257
+ }
258
+ }
259
+ }
260
+ end
261
+
262
+ it 'adds the person data to the configuration' do
263
+ _, _, response = subject.call(env)
264
+ new_body = response.body.join
265
+
266
+ expect(new_body).to include(expected_js_options.to_json)
267
+ end
268
+
269
+ context 'when the person data is nil' do
270
+ let(:env) do
271
+ {
272
+ 'rollbar.person_data' => nil
273
+ }
274
+ end
275
+
276
+ it 'works correctly and doesnt add anything about person data' do
277
+ _, _, response = subject.call(env)
278
+ new_body = response.body.join
279
+
280
+ expect(new_body).not_to include('person')
281
+ end
282
+ end
283
+ end
233
284
  end
234
285
 
235
286
  context 'having the config disabled', :add_js => false do
@@ -536,6 +536,92 @@ describe Rollbar do
536
536
  Rollbar.error(exception).should == 'disabled'
537
537
  end
538
538
 
539
+ context 'using configuration.use_exception_level_filters_default' do
540
+ before do
541
+ Rollbar.configure do |config|
542
+ config.use_exception_level_filters_default = true
543
+ end
544
+ end
545
+
546
+ context 'without use_exception_level_filters argument' do
547
+ it 'sends the correct filtered level' do
548
+ Rollbar.configure do |config|
549
+ config.exception_level_filters = { 'NameError' => 'warning' }
550
+ end
551
+
552
+ Rollbar.error(exception)
553
+
554
+ expect(Rollbar.last_report[:level]).to be_eql('warning')
555
+ end
556
+
557
+ it 'ignore ignored exception classes' do
558
+ Rollbar.configure do |config|
559
+ config.exception_level_filters = { 'NameError' => 'ignore' }
560
+ end
561
+
562
+ logger_mock.should_not_receive(:info)
563
+ logger_mock.should_not_receive(:warn)
564
+ logger_mock.should_not_receive(:error)
565
+
566
+ Rollbar.error(exception)
567
+ end
568
+
569
+ it 'should not use the filters if overriden at log site' do
570
+ Rollbar.configure do |config|
571
+ config.exception_level_filters = { 'NameError' => 'ignore' }
572
+ end
573
+
574
+ Rollbar.error(exception, :use_exception_level_filters => false)
575
+
576
+ expect(Rollbar.last_report[:level]).to be_eql('error')
577
+ end
578
+ end
579
+ end
580
+
581
+ context 'using :use_exception_level_filters option as true' do
582
+ it 'sends the correct filtered level' do
583
+ Rollbar.configure do |config|
584
+ config.exception_level_filters = { 'NameError' => 'warning' }
585
+ end
586
+
587
+ Rollbar.error(exception, :use_exception_level_filters => true)
588
+ expect(Rollbar.last_report[:level]).to be_eql('warning')
589
+ end
590
+
591
+ it 'ignore ignored exception classes' do
592
+ Rollbar.configure do |config|
593
+ config.exception_level_filters = { 'NameError' => 'ignore' }
594
+ end
595
+
596
+ logger_mock.should_not_receive(:info)
597
+ logger_mock.should_not_receive(:warn)
598
+ logger_mock.should_not_receive(:error)
599
+
600
+ Rollbar.error(exception, :use_exception_level_filters => true)
601
+ end
602
+
603
+ context 'using :use_exception_level_filters option as false' do
604
+ it 'sends the correct filtered level' do
605
+ Rollbar.configure do |config|
606
+ config.exception_level_filters = { 'NameError' => 'warning' }
607
+ end
608
+
609
+ Rollbar.error(exception, :use_exception_level_filters => false)
610
+ expect(Rollbar.last_report[:level]).to be_eql('error')
611
+ end
612
+
613
+ it 'ignore ignored exception classes' do
614
+ Rollbar.configure do |config|
615
+ config.exception_level_filters = { 'NameError' => 'ignore' }
616
+ end
617
+
618
+ Rollbar.error(exception, :use_exception_level_filters => false)
619
+
620
+ expect(Rollbar.last_report[:level]).to be_eql('error')
621
+ end
622
+ end
623
+ end
624
+
539
625
  context 'using :use_exception_level_filters option as true' do
540
626
  it 'sends the correct filtered level' do
541
627
  Rollbar.configure do |config|
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rollbar
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.14.1
4
+ version: 2.15.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: 2017-03-15 00:00:00.000000000 Z
11
+ date: 2017-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  description: Easy and powerful exception tracking for Ruby
@@ -32,11 +32,11 @@ executables:
32
32
  extensions: []
33
33
  extra_rdoc_files: []
34
34
  files:
35
- - .codeclimate.yml
36
- - .gitignore
37
- - .gitmodules
38
- - .rubocop.yml
39
- - .travis.yml
35
+ - ".codeclimate.yml"
36
+ - ".gitignore"
37
+ - ".gitmodules"
38
+ - ".rubocop.yml"
39
+ - ".travis.yml"
40
40
  - Appraisals
41
41
  - CHANGELOG.md
42
42
  - Gemfile
@@ -270,17 +270,17 @@ require_paths:
270
270
  - lib
271
271
  required_ruby_version: !ruby/object:Gem::Requirement
272
272
  requirements:
273
- - - '>='
273
+ - - ">="
274
274
  - !ruby/object:Gem::Version
275
275
  version: '0'
276
276
  required_rubygems_version: !ruby/object:Gem::Requirement
277
277
  requirements:
278
- - - '>='
278
+ - - ">="
279
279
  - !ruby/object:Gem::Version
280
280
  version: '0'
281
281
  requirements: []
282
282
  rubyforge_project:
283
- rubygems_version: 2.6.10
283
+ rubygems_version: 2.2.3
284
284
  signing_key:
285
285
  specification_version: 4
286
286
  summary: Reports exceptions to Rollbar