activeerror 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bcbbba510a5237a8b23e556ee351989b0585600255f67ae21b8ec58502077184
4
- data.tar.gz: '0385e18e2e77ba3072ca0148cb31f555e9e9442f21db101e2e8e74ce3a8e8337'
3
+ metadata.gz: bda7db32534497efbf3630112104606b5cfb0d4c5c99a75338d5589f9c28de48
4
+ data.tar.gz: 2082ca8e2aff144ed93c968998457c1228c9023af24f45a20f0e18070cc5fb9b
5
5
  SHA512:
6
- metadata.gz: ad4cf1ef4a5d78d5296efe74e97201658174f4cb4d58b7760556730e6c393e84e20170ee05fb4e95f1b845bd6fc737428e2b0c2ba7785346643204a7c6d59e41
7
- data.tar.gz: 922c1b11c18d71bd9ee797567ba03f002ef4c9d5594b1333911a1327f6ee6c65597e4c72cfc72aa7333887064fce3078d6997a52f6bb6ef186c9bdd83d801041
6
+ metadata.gz: 4cfa42adda5bb374631f3cb1dad4563de1ced011a4733615f9565f81c608731d1a18c146ef134a16836a819b9cf32beffffbe92aa5d11b93719a8331e51d3949
7
+ data.tar.gz: fd11b9f2a1b16bbcc0695da85940d9c4f326ca8b46e1b1aa63f0866f06d90b86bf00d7e7a74e4d8600df27db7e137f8160137fb51cb9e3f9e23f0eb8b4bc6726
data/README.md CHANGED
@@ -2,15 +2,14 @@
2
2
 
3
3
  One of the fundemental tools needed to take your Rails app to production is a
4
4
  way to track errors that are triggered. Unfortunately, theres no free, easy,
5
- open source way to track them for small or medium apps. Honeybadger, Sentry,
5
+ open source way to track them for small or medium apps. Honeybadger, Sentry,
6
6
  and AppSignal are great, but they are are closed source. With Sentry
7
7
  looking at using your data as training
8
8
  data([link](https://blog.sentry.io/ai-privacy-and-terms-of-service-updates/?original_referrer=https%3A%2F%2Fsentry.io%2F))
9
9
  there should be an easy open source alternative where you control the data.
10
10
 
11
- ActiveError hooks into the [error reporting
12
- api](https://guides.rubyonrails.org/error_reporting.html) baked directly into
13
- Rails. These third party error loggers also try to make their own fancy
11
+ ActiveError hooks into the middleware of Rails.
12
+ These third party error loggers also try to make their own fancy
14
13
  backtrace and debugging view. But the one Rails developers are most comfortable
15
14
  with is the one baked into Rails that we use everyday in development. So with
16
15
  ActiveError, when an error gets raised it's captured and stored in the
@@ -1,22 +1,24 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveError
4
- class ErrorSubscriber
5
- def report(exception, context:, **_opts)
6
- return if Rails.env.local?
7
-
8
- Captor.new(exception:, request: context[:active_error_request]).capture
9
- end
10
- end
11
-
12
4
  class Engine < ::Rails::Engine
5
+ ActiveJobRequest = Struct.new(:parameters, :filtered_parameters)
6
+
13
7
  isolate_namespace ActiveError
14
8
 
15
9
  initializer "active_error.middleware" do |_app|
16
- ActionController::Base.before_action do
17
- Rails.error.set_context(active_error_request: request)
10
+ app.config.middleware.use ActiveError::Middleware
11
+
12
+ ::ActiveJob::Base.class_eval do |base|
13
+ base.set_callback :perform, :around do |_param, block|
14
+ block.call
15
+ rescue StandardError => e
16
+ ActiveError::Captor.new(exception: e, request: ActiveJobRequest.new(
17
+ arguments, arguments
18
+ )).capture
19
+ raise e
20
+ end
18
21
  end
19
- Rails.error.subscribe(::ActiveError::ErrorSubscriber.new)
20
22
  end
21
23
  end
22
24
  end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActiveError
4
+ class Middleware
5
+ def initialize(app)
6
+ @app = app
7
+ end
8
+
9
+ def call(env)
10
+ @app.call(env)
11
+ rescue Exception => exception # rubocop:disable Lint/RescueException, Naming/RescuedExceptionsVariableName
12
+ Captor.new(exception:, request: env.request).capture
13
+
14
+ raise
15
+ end
16
+ end
17
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveError
4
- VERSION = "1.0.3"
4
+ VERSION = "1.0.4"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeerror
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Pezza
@@ -66,6 +66,7 @@ files:
66
66
  - lib/active_error/exception_mock.rb
67
67
  - lib/active_error/exception_mock/default.rb
68
68
  - lib/active_error/exception_mock/template_error.rb
69
+ - lib/active_error/middleware.rb
69
70
  - lib/active_error/renderer.rb
70
71
  - lib/active_error/version.rb
71
72
  - lib/activeerror.rb