activeerror 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -2
- data/db/migrate/20200727225318_create_active_error_instances.rb +1 -1
- data/lib/active_error/engine.rb +9 -15
- data/lib/active_error/railtie.rb +17 -0
- data/lib/active_error/version.rb +1 -1
- data/lib/active_error.rb +1 -1
- metadata +3 -3
- data/lib/active_error/middleware.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7558b7d240e80821f7d6d8640b5ca6ef7ef5b34634f40e3482bfc99bf64107ea
|
4
|
+
data.tar.gz: e10bda1728e93ca0ecbd4051e406cbaeb17548599c6d98591b5b9083036cb371
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f50369819d20d1b2c36ab8b6572f02ffd33da5c2abac74f1ecd177dbb0283493d2b9d572c3265ba135e0ece593c55bd1374b361aed66dcc90d16b5122c0bc5fd
|
7
|
+
data.tar.gz: 76d577c8e82e6e95ef1cdc9c8e01c12789278ae1f21a4c5424a03a484985990251fc48b8ab520dd7f4e1139a5c66d1972d11ddd913aed98bd46e4a3954e8fb8b
|
data/README.md
CHANGED
@@ -8,8 +8,9 @@ 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
|
12
|
-
|
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
|
13
14
|
backtrace and debugging view. But the one Rails developers are most comfortable
|
14
15
|
with is the one baked into Rails that we use everyday in development. So with
|
15
16
|
ActiveError, when an error gets raised it's captured and stored in the
|
data/lib/active_error/engine.rb
CHANGED
@@ -1,25 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module ActiveError
|
4
|
-
|
5
|
-
ActiveJobRequest = Struct.new(:parameters, :filtered_parameters, :env, :url)
|
4
|
+
ActiveJobRequest = Struct.new(:parameters, :filtered_parameters, :env, :url)
|
6
5
|
|
6
|
+
class Engine < ::Rails::Engine
|
7
7
|
isolate_namespace ActiveError
|
8
8
|
|
9
|
-
initializer "active_error.middleware" do |
|
10
|
-
|
11
|
-
|
9
|
+
initializer "active_error.middleware" do |_app|
|
10
|
+
ActionController::Base.before_action do
|
11
|
+
Rails.error.set_context(active_error_request: request)
|
12
|
+
end
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
rescue StandardError => e
|
17
|
-
ActiveError::Captor.new(exception: e, request: ActiveJobRequest.new(
|
18
|
-
serialize, serialize
|
19
|
-
)).capture
|
20
|
-
raise e
|
21
|
-
end
|
22
|
-
end
|
14
|
+
ActiveJob::Base.before_perform do
|
15
|
+
Rails.error.set_context(active_error_request:
|
16
|
+
ActiveJobRequest.new(serialize, serialize))
|
23
17
|
end
|
24
18
|
end
|
25
19
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
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
|
+
class Railtie < ::Rails::Railtie
|
13
|
+
initializer "active_error.error_reporter" do |_app|
|
14
|
+
Rails.error.subscribe(::ActiveError::ErrorSubscriber.new)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/active_error/version.rb
CHANGED
data/lib/active_error.rb
CHANGED
@@ -5,8 +5,8 @@ require "active_error/exception_mock/template_error"
|
|
5
5
|
require "active_error/exception_mock"
|
6
6
|
require "active_error/captor"
|
7
7
|
require "active_error/renderer"
|
8
|
-
require "active_error/middleware"
|
9
8
|
require "active_error/engine"
|
9
|
+
require "active_error/railtie"
|
10
10
|
require "active_error/version"
|
11
11
|
|
12
12
|
module ActiveError
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeerror
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Pezza
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
11
|
+
date: 2024-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -66,7 +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/
|
69
|
+
- lib/active_error/railtie.rb
|
70
70
|
- lib/active_error/renderer.rb
|
71
71
|
- lib/active_error/version.rb
|
72
72
|
- lib/activeerror.rb
|
@@ -1,17 +0,0 @@
|
|
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: ActionDispatch::Request.new(env)).capture
|
13
|
-
|
14
|
-
raise
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|