openstax_rescue_from 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZjY0Mjk0YjIwNjgwNjE4ZDQ5MTFhNDdmNzIwNGRkNzc5MDFlOWRlMw==
4
+ YWRiNjg3NmVhNWU4ZGViMzRlZGRhMmIyYzVmZTZiOWY0ODRhODdiNQ==
5
5
  data.tar.gz: !binary |-
6
- NzJlZDRmNjMwNjdmMzUwMzgyNTIwMGYzN2NmNWZhZTM1Njg5MjU4Nw==
6
+ NzljMGY2Y2ViNjY2OTlkYjJlMjA4YmQ0NDY2YzUxNjFkOTdiY2E4YQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NDBmMTJiOTg1ZGQwODhjZTM4NWZjY2ZhMTNhMTc2MGYzODdkZGRmZWRlMGYy
10
- MmNmMTA1M2VmMTcyNjE0NGIzNzZlN2UxNzhmM2QyMzhlODY3MWY2ZDg3OGU4
11
- OGRiZWU1MDRhY2I0NGQ0Mjc5NDk5ZGE5MTZkMGNhMzk5YzNiMjg=
9
+ YTUyMWE3NGM4YThiZjQ3ZDk1MTJjNWU5NzgyZDkwMDQ0OGUxZWVkYWNhNWVk
10
+ ZTY0Y2NmMGVkNWI1NDk3YmYxYTE4YTgzYjgxMGFmMTJmNzUwYjk1NTdjNmI4
11
+ OWJhMDM1ZTkzYjlhNTU5OWVkNDE3NmI3NjJjY2Y1YzRhNTU0MWY=
12
12
  data.tar.gz: !binary |-
13
- YzczZDMwZGVhN2I1ODg1NGY0NGY3ODg0ZmMxMzgxNDgwODliMzFlMTAyNzk1
14
- YzZmYjQ5MGVhY2Q3MmJmYzhiNjhmNjIzYmZjNWIyYzA3NjZlNDAzOWU4OWIw
15
- N2Y1MGZhZDNiMDY3MGUxYjhhNWIzYmI3MzkwZTJlM2Q5M2JhYzI=
13
+ MGYyMjQ3MWNjOTNkY2ExMzgzNTg0OWQxN2JjYTgxZTExOTA3YjA5Y2Y2MzNj
14
+ NGQwZWNhZmJhZjIzZTQ4YmEzNmZhYjQzYWIxMGZjOTBjY2I0NTVkNzM5Mzk3
15
+ NzEzZDA0NWRmNjQwMzIyYmMzMTA2OTBmZjc3NDJlMTVmMWI1NDI=
@@ -0,0 +1,9 @@
1
+ module OpenStax
2
+ module RescueFrom
3
+ class ExceptionCauseProxy < ExceptionProxy
4
+ def logger_backtrace
5
+ first_backtrace_line
6
+ end
7
+ end
8
+ end
9
+ end
@@ -28,15 +28,15 @@ module OpenStax
28
28
  end
29
29
 
30
30
  def cause
31
- @cause ||= exception.respond_to?(:cause) ? exception.cause : nil
31
+ @cause ||= if exception.respond_to?(:cause) && exception.cause
32
+ ExceptionCauseProxy.new(exception.cause)
33
+ else
34
+ nil
35
+ end
32
36
  end
33
37
 
34
- def backtrace
35
- @backtrace ||= cause.blank? ? first_backtrace_line : all_backtrace_lines
36
- end
37
-
38
- def all_backtrace_lines
39
- @all_backtrace_lines ||= exception.backtrace.join("\n")
38
+ def logger_backtrace
39
+ @backtrace ||= exception.backtrace.join("\n")
40
40
  end
41
41
 
42
42
  def first_backtrace_line
@@ -10,16 +10,15 @@ module OpenStax
10
10
  def record_system_error!(prefix = "An exception occurred")
11
11
  Rails.logger.error("#{prefix}: #{proxy.name} [#{proxy.error_id}] " +
12
12
  "<#{proxy.message}> #{proxy.extras}\n\n" +
13
- "#{proxy.backtrace}")
13
+ "#{proxy.logger_backtrace}")
14
14
 
15
15
  record_system_error_recursively!
16
16
  end
17
17
 
18
18
  private
19
19
  def record_system_error_recursively!
20
- if proxy.cause
21
- RescueFrom.register_exception(proxy.cause.class)
22
- @proxy = ExceptionProxy.new(proxy.cause)
20
+ if @proxy = proxy.cause
21
+ RescueFrom.register_exception(proxy.name)
23
22
  record_system_error!("Exception cause")
24
23
  end
25
24
  end
@@ -1,5 +1,5 @@
1
1
  module OpenStax
2
2
  module RescueFrom
3
- VERSION = "1.3.0"
3
+ VERSION = "1.4.0"
4
4
  end
5
5
  end
@@ -6,6 +6,7 @@ require 'openstax/rescue_from/mute_listener'
6
6
  require 'openstax/rescue_from/logger'
7
7
 
8
8
  require 'openstax/rescue_from/exception_proxy'
9
+ require 'openstax/rescue_from/exception_cause_proxy'
9
10
 
10
11
  module OpenStax
11
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openstax_rescue_from
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Slavinsky
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2015-10-07 00:00:00.000000000 Z
12
+ date: 2015-10-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -177,6 +177,7 @@ files:
177
177
  - lib/openstax/rescue_from/controller.rb
178
178
  - lib/openstax/rescue_from/default_exceptions.rb
179
179
  - lib/openstax/rescue_from/engine.rb
180
+ - lib/openstax/rescue_from/exception_cause_proxy.rb
180
181
  - lib/openstax/rescue_from/exception_options.rb
181
182
  - lib/openstax/rescue_from/exception_proxy.rb
182
183
  - lib/openstax/rescue_from/logger.rb