failtale-reporter 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,51 +1,53 @@
1
1
 
2
2
  module FailtaleReporter
3
- module Adapters
4
-
5
- module Rails
6
-
7
- IGNORED_EXCEPTIONS = ['ActiveRecord::RecordNotFound',
8
- 'ActionController::RoutingError',
9
- 'ActionController::InvalidAuthenticityToken',
10
- 'CGI::Session::CookieStore::TamperedWithCookie']
11
-
12
- IGNORED_EXCEPTIONS.map!{|e| eval(e) rescue nil }.compact!
13
- IGNORED_EXCEPTIONS.freeze
14
-
15
- def self.included(target)
16
- target.send :alias_method_chain, :rescue_action_in_public, :failtale
17
-
18
- FailtaleReporter.configure do |config|
19
- config.ignored_exceptions IGNORED_EXCEPTIONS
20
- config.default_reporter "rails"
21
- config.application_root RAILS_ROOT
22
- config.information_collector do |error, controller|
23
- env = error.environment
24
- env = env.merge(controller.request.env)
25
-
26
- env.delete('action_controller.rescue.response')
27
- env.delete('action_controller.rescue.request')
28
- error.environment = env
29
- end
30
- end
31
- end
32
-
33
- def rescue_action_in_public_with_failtale(exception)
34
- FailtaleReporter.report(exception, self) unless is_private?
35
- rescue_action_in_public_without_failtale(exception)
36
- end
37
-
38
- protected
39
-
40
- def is_private? #nodoc:
41
- if defined?(RAILS_ENV)
42
- ['development', 'test'].include?(RAILS_ENV)
43
- end
3
+
4
+ def self.force_public(flag=nil)
5
+ @force_public = flag unless flag.nil?
6
+ @force_public
7
+ end
8
+
9
+ end
10
+
11
+ module FailtaleReporter::Adapters::Rails
12
+
13
+ IGNORED_EXCEPTIONS = ['ActiveRecord::RecordNotFound',
14
+ 'ActionController::RoutingError',
15
+ 'ActionController::InvalidAuthenticityToken',
16
+ 'CGI::Session::CookieStore::TamperedWithCookie']
17
+
18
+ IGNORED_EXCEPTIONS.map!{|e| eval(e) rescue nil }.compact!
19
+ IGNORED_EXCEPTIONS.freeze
20
+
21
+ def self.included(target)
22
+ target.send :alias_method_chain, :rescue_action_in_public, :failtale
23
+
24
+ FailtaleReporter.configure do |config|
25
+ config.ignored_exceptions IGNORED_EXCEPTIONS
26
+ config.default_reporter "rails"
27
+ config.application_root RAILS_ROOT
28
+ config.information_collector do |error, controller|
29
+ env = error.environment
30
+ env = env.merge(controller.request.env)
31
+
32
+ env.delete('action_controller.rescue.response')
33
+ env.delete('action_controller.rescue.request')
34
+ error.environment = env
44
35
  end
45
-
46
36
  end
47
-
48
37
  end
38
+
39
+ def rescue_action_in_public_with_failtale(exception)
40
+ FailtaleReporter.report(exception, self) unless is_private?
41
+ rescue_action_in_public_without_failtale(exception)
42
+ end
43
+
44
+ protected
45
+
46
+ def is_private?
47
+ FailtaleReporter.force_public or (
48
+ defined?(Rails) and ['development', 'test'].include?(Rails.env))
49
+ end
50
+
49
51
  end
50
52
 
51
53
  ::ActionController::Base.send :include, FailtaleReporter::Adapters::Rails
@@ -1,3 +1,3 @@
1
1
  module FailtaleReporter
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -1,2 +1 @@
1
-
2
- ::FailtaleReporter.load_adapter('rails')
1
+ ::FailtaleReporter.load_adapter('rails')
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 0
9
- version: 0.2.0
8
+ - 1
9
+ version: 0.2.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Simon Menke