errplane 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -33,13 +33,27 @@ module Errplane
33
33
  @configuration ||= Configuration.new
34
34
  end
35
35
 
36
- def transmit_to_api(e, env)
36
+ def transmit_unless_ignorable(e, env)
37
37
  begin
38
- ::Rails.logger.info("\nTransmitter: #{transmitter.inspect}")
39
- ::Rails.logger.info("\nBlack Box: #{assemble_black_box_for(e).to_json}")
40
- ::Rails.logger.info("\nIgnorable Exception? #{ignorable_exception?(e)}")
41
- ::Rails.logger.info("\nEnvironment: #{ENV.to_hash}")
42
- transmitter.relay(assemble_black_box_for(e)) unless ignorable_exception?(e)
38
+ black_box = assemble_black_box_for(e)
39
+ ::Rails.logger.info("\nTransmitter: #{transmitter.inspect}")
40
+ ::Rails.logger.info("\nBlack Box: #{black_box.to_json}")
41
+ ::Rails.logger.info("\nIgnorable Exception? #{ignorable_exception?(e)}")
42
+ ::Rails.logger.info("\nEnvironment: #{ENV.to_hash}")
43
+ transmitter.relay(black_box) unless ignorable_exception?(e)
44
+ rescue
45
+ configuration.logger.info("[Errplane] Something went terribly wrong. Exception failed to take off.")
46
+ end
47
+ end
48
+
49
+ def transmit(e)
50
+ begin
51
+ black_box = assemble_black_box_for(e)
52
+ ::Rails.logger.info("\nTransmitter: #{transmitter.inspect}")
53
+ ::Rails.logger.info("\nBlack Box: #{black_box.to_json}")
54
+ ::Rails.logger.info("\nIgnorable Exception? #{ignorable_exception?(e)}")
55
+ ::Rails.logger.info("\nEnvironment: #{ENV.to_hash}")
56
+ transmitter.relay(black_box)
43
57
  rescue
44
58
  configuration.logger.info("[Errplane] Something went terribly wrong. Exception failed to take off.")
45
59
  end
@@ -8,7 +8,7 @@ module Errplane
8
8
  begin
9
9
  response = @app.call(env)
10
10
  rescue => e
11
- Errplane.transmit_to_api(e, env)
11
+ Errplane.transmit_unless_ignorable(e, env)
12
12
  raise(e)
13
13
  end
14
14
 
@@ -8,7 +8,7 @@ module Errplane
8
8
 
9
9
  def render_exception_with_errplane(env, e)
10
10
  controller = env['action_controller.instance']
11
- Errplane.transmit_to_api(e, env)
11
+ Errplane.transmit_unless_ignorable(e, env)
12
12
  render_exception_without_errplane(env, e)
13
13
  end
14
14
  end
@@ -1,6 +1,5 @@
1
1
  require 'errplane'
2
2
  require 'rails'
3
- require 'rack'
4
3
 
5
4
  module Errplane
6
5
  class Railtie < ::Rails::Railtie
@@ -7,6 +7,6 @@
7
7
  # end
8
8
 
9
9
  error do
10
- Errplane.transmit_to_api(request.env['sinatra.error'], request.env)
10
+ Errplane.transmit_unless_ignorable(request.env['sinatra.error'], request.env)
11
11
  raise request.env['sinatra.error']
12
12
  end
@@ -1,3 +1,3 @@
1
1
  module Errplane
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: errplane
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: