activeerror 1.1.0 → 1.1.2
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.
- checksums.yaml +4 -4
- data/README.md +6 -6
- data/db/migrate/20200727220359_create_active_error_faults.rb +3 -3
- data/lib/active_error/captor.rb +2 -1
- data/lib/active_error/engine.rb +3 -1
- data/lib/active_error/middleware.rb +19 -0
- data/lib/active_error/renderer.rb +9 -14
- data/lib/active_error/version.rb +1 -1
- data/lib/active_error.rb +1 -0
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fc62c697f1a27d374f8d0d687b642f0ec73d6037ccbf3b0a50b0d054f0f65d5
|
4
|
+
data.tar.gz: 96c4ea9687255a0a16c5ad9b37ea2bcec3374b9a858c95aa8c4830770b4994c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be2e3252a21447c13d3226f2521f428ae9c9e0a2904048e0b4dcd1f9ce37385baab3dd78f746fa6391b2ba5e02631b258c35f9b5466924d1d75afeb96ddd1e14
|
7
|
+
data.tar.gz: 00341ace320c7b46d4e11aaa3bef6c9aa2f68b7cb35c38e29690dccb1b7cb1aaae03a44f0040036724c33e4876081971a7d216206801550dd0a42515b61e8352
|
data/README.md
CHANGED
@@ -19,8 +19,8 @@ noise) and then we recreate the error and display it using the built in debug
|
|
19
19
|
view from Rails. Once you've resolved the error you can click "Resolve" which
|
20
20
|
will destroy the record.
|
21
21
|
|
22
|
-

|
23
|
+

|
24
24
|
|
25
25
|
## Installation
|
26
26
|
Add this line to your application's Gemfile:
|
@@ -41,11 +41,11 @@ $ gem install activeerror
|
|
41
41
|
|
42
42
|
And then install migrations:
|
43
43
|
```bash
|
44
|
-
bin/rails active_error:install
|
45
|
-
bin/rails
|
44
|
+
bin/rails generate active_error:install
|
45
|
+
bin/rails db:migrate
|
46
46
|
```
|
47
47
|
|
48
|
-
This also mounts a route
|
48
|
+
This also mounts a route in your routes file to view the errors at `/errors`.
|
49
49
|
|
50
50
|
|
51
51
|
##### Config
|
@@ -70,7 +70,7 @@ push git commits and tags, and push the `.gem` file to GitHub.
|
|
70
70
|
## Contributing
|
71
71
|
|
72
72
|
Bug reports and pull requests are welcome on
|
73
|
-
[GitHub](https://github.com/npezza93/
|
73
|
+
[GitHub](https://github.com/npezza93/activeerror). This project is intended to
|
74
74
|
be a safe, welcoming space for collaboration, and contributors are expected to
|
75
75
|
adhere to the [Contributor Covenant](http://contributor-covenant.org) code of
|
76
76
|
conduct.
|
@@ -4,14 +4,14 @@ class CreateActiveErrorFaults < ActiveRecord::Migration[7.1]
|
|
4
4
|
def change # rubocop:disable Metrics/AbcSize
|
5
5
|
create_table :active_error_faults do |t|
|
6
6
|
t.belongs_to :cause
|
7
|
-
t.binary :backtrace,
|
8
|
-
t.binary :backtrace_locations,
|
7
|
+
t.binary :backtrace, limit: 512.megabytes
|
8
|
+
t.binary :backtrace_locations, limit: 512.megabytes
|
9
9
|
t.string :klass
|
10
10
|
t.text :message
|
11
11
|
t.string :controller
|
12
12
|
t.string :action
|
13
13
|
t.integer :instances_count
|
14
|
-
t.text :blamed_files,
|
14
|
+
t.text :blamed_files, limit: 512.megabytes
|
15
15
|
t.text :options
|
16
16
|
t.index %i(klass backtrace message)
|
17
17
|
|
data/lib/active_error/captor.rb
CHANGED
data/lib/active_error/engine.rb
CHANGED
@@ -7,7 +7,9 @@ module ActiveError
|
|
7
7
|
class Engine < ::Rails::Engine
|
8
8
|
isolate_namespace ActiveError
|
9
9
|
|
10
|
-
initializer "active_error.middleware" do |
|
10
|
+
initializer "active_error.middleware" do |app|
|
11
|
+
app.config.middleware.use ActiveError::Middleware
|
12
|
+
|
11
13
|
ActionController::Base.before_action do
|
12
14
|
Rails.error.set_context(active_error_request: request)
|
13
15
|
end
|
@@ -0,0 +1,19 @@
|
|
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 StandardError => e
|
12
|
+
unless Rails.application.config.reloading_enabled?
|
13
|
+
Rails.error.report(e, handled: false,
|
14
|
+
source: "application.action_dispatch")
|
15
|
+
end
|
16
|
+
raise
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -16,27 +16,22 @@ module ActiveError
|
|
16
16
|
attr_reader :exception, :instance
|
17
17
|
|
18
18
|
delegate :trace_to_show, :source_to_show_id, :source_extracts,
|
19
|
-
:traces, to: :
|
19
|
+
:traces, to: :exception_wrapper
|
20
20
|
|
21
|
-
def
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
def wrapper
|
26
|
-
@wrapper ||=
|
27
|
-
ActionDispatch::ExceptionWrapper.new(backtrace_cleaner, exception)
|
21
|
+
def exception_wrapper
|
22
|
+
@exception_wrapper ||=
|
23
|
+
ActionDispatch::ExceptionWrapper.new(Rails.backtrace_cleaner, exception)
|
28
24
|
end
|
29
25
|
|
30
26
|
def file
|
31
|
-
"rescues/#{
|
27
|
+
"rescues/#{exception_wrapper.rescue_template}"
|
32
28
|
end
|
33
29
|
|
34
30
|
def template
|
35
|
-
ActionDispatch::DebugView.
|
36
|
-
request: instance.request, exception_wrapper
|
37
|
-
|
38
|
-
|
39
|
-
)
|
31
|
+
ActionDispatch::DebugView.
|
32
|
+
new(request: instance.request, exception_wrapper:, traces:,
|
33
|
+
exception: exception_wrapper.exception, trace_to_show:,
|
34
|
+
source_extracts:, show_source_idx: source_to_show_id,)
|
40
35
|
end
|
41
36
|
end
|
42
37
|
end
|
data/lib/active_error/version.rb
CHANGED
data/lib/active_error.rb
CHANGED
@@ -4,6 +4,7 @@ require "active_error/exception_mock/default"
|
|
4
4
|
require "active_error/exception_mock/template_error"
|
5
5
|
require "active_error/exception_mock"
|
6
6
|
require "active_error/captor"
|
7
|
+
require "active_error/middleware"
|
7
8
|
require "active_error/renderer"
|
8
9
|
require "active_error/engine"
|
9
10
|
require "active_error/railtie"
|
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.1.
|
4
|
+
version: 1.1.2
|
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-
|
11
|
+
date: 2024-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '7.
|
19
|
+
version: '7.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '7.
|
26
|
+
version: '7.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: useragent
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -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/railtie.rb
|
70
71
|
- lib/active_error/renderer.rb
|
71
72
|
- lib/active_error/version.rb
|
@@ -91,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
92
|
- !ruby/object:Gem::Version
|
92
93
|
version: '0'
|
93
94
|
requirements: []
|
94
|
-
rubygems_version: 3.5.
|
95
|
+
rubygems_version: 3.5.17
|
95
96
|
signing_key:
|
96
97
|
specification_version: 4
|
97
98
|
summary: Rails exception logger
|