me_exceptional 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,6 @@
1
- class MeExceptional::Mailer < ::ActionMailer::Base
1
+ class MeExceptional::Mailer < ActionMailer::Base
2
+
3
+ default :from => MeExceptional.mailer_from
2
4
 
3
5
  def exceptional(message, params)
4
6
  @message, @params = message, params
@@ -9,7 +11,7 @@ class MeExceptional::Mailer < ::ActionMailer::Base
9
11
 
10
12
  def error_mail(message, params)
11
13
  @message, @params = message, params
12
- subject = "Exception! #{message}"
14
+ subject = "[EXCEPTION] #{message}"
13
15
  mail(:from => MeExceptional.mailer_from, :to => MeExceptional.mailer_to, :subject => subject)
14
16
  end
15
17
 
@@ -6,12 +6,6 @@ module MeExceptional
6
6
  class Engine < ::Rails::Engine
7
7
  engine_name :me_exceptional
8
8
 
9
- #initialize "me_exceptional.load_app_instance_data" do |app|
10
- # MeExceptional.setup do |config|
11
- # config.app_root = app.root
12
- # end
13
- #end
14
-
15
9
  end
16
10
  end
17
11
 
@@ -4,30 +4,30 @@ module MeExceptional
4
4
  module BasicExtension
5
5
 
6
6
  def exception_catcher(e)
7
- if Rails.env == 'production'
8
7
 
9
- m = MeExceptional::Mailer.error_mail(e.message,
10
- :backtrace => e.backtrace.join("\n"),
11
- :timestamp => Time.zone.now)
8
+ message = "#{e.class}: #{e.message}"
9
+ content = {:backtrace => e.backtrace.join("\n"), :timestamp => Time.zone.now}
12
10
 
13
- # blocking on purpose to be sure this gets sent!
14
- m.deliver
11
+ m = MeExceptional::Mailer.error_mail(message, content)
12
+ m.deliver
15
13
 
16
- end
17
- raise e
14
+ Rails.logger.error "[EXCEPTION] #{e.class}: #{e.message}"
18
15
  end
19
16
 
20
17
  module ClassMethods
18
+
21
19
  def rescue_mail_from_methods(*methods)
22
20
 
23
21
  methods.each do |method|
24
22
  class_eval <<-EOF
25
- def #{method}_rescuable
26
- method
23
+ alias_method :#{method}_non_rescuable, :#{method}
24
+
25
+ def #{method}(*args)
26
+ #{method}_non_rescuable(*args)
27
27
  rescue Exception => e
28
- rescue_with_handler(e)
28
+ exception_catcher(e)
29
+ #rescue_with_handler(e)
29
30
  end
30
- alias_method :#{method}, :#{method}_rescuable
31
31
  EOF
32
32
  end
33
33
 
@@ -36,12 +36,6 @@ module MeExceptional
36
36
 
37
37
  def self.included(base)
38
38
  base.extend(ClassMethods)
39
-
40
- base.instance_eval <<-EOF
41
- include ActiveSupport::Rescuable
42
- rescue_from Exception, :with => :exception_catcher
43
- EOF
44
-
45
39
  end
46
40
 
47
41
  end
@@ -49,3 +43,4 @@ module MeExceptional
49
43
  end
50
44
 
51
45
 
46
+
@@ -1,3 +1,3 @@
1
1
  module MeExceptional
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -9,7 +9,7 @@ module MeExceptional
9
9
  mattr_accessor :mailer_to
10
10
  @@mailer_to = nil
11
11
 
12
- mattr_accessor :app_root
12
+ #mattr_accessor :app_root
13
13
 
14
14
  def self.setup
15
15
  yield self
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: me_exceptional
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kai Rubarth
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-01-11 00:00:00 Z
18
+ date: 2012-01-15 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: activesupport