activeerror 1.0.10 → 1.1.0
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 +10 -0
- data/app/views/layouts/active_error/application.html.erb +4 -2
- data/lib/active_error/captor.rb +11 -2
- data/lib/active_error/engine.rb +4 -3
- data/lib/active_error/exception_mock/default.rb +7 -1
- data/lib/active_error/railtie.rb +2 -1
- data/lib/active_error/version.rb +1 -1
- data/lib/active_error.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '018a130d382073d7eb66c2f786dc6b2ad5b5ef59f26f4a4e717dd82d66cd9ed6'
|
4
|
+
data.tar.gz: 135d86e49142e37547f30add626f9f359b59afd7619961e25cf4c5b805598126
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da8062b4201ff1e12b224c2801805727270a52ab2f0d87cfacbc2e3e2c212093e4ae06649a59833934043e8c8b7662fa631ed2d3ca719351596c3a8786abe59d
|
7
|
+
data.tar.gz: 868fa1fc5fb9199c2352edfcb68e4d451a111c956a7c6a7293f9265a5c6dbe5e43a62c7422b8cf70c7e79ea446a0067baa5370d34a789d9116756e366acbb477
|
data/README.md
CHANGED
@@ -47,6 +47,16 @@ bin/rails rails db:migrate
|
|
47
47
|
|
48
48
|
This also mounts a route n your routes file to view the errors at `/errors`.
|
49
49
|
|
50
|
+
|
51
|
+
##### Config
|
52
|
+
|
53
|
+
You can supply the string version of an error class to `ignored` to ignore
|
54
|
+
classes of errors.
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
ActiveError.ignored = ["NoMethodError"]
|
58
|
+
```
|
59
|
+
|
50
60
|
## Development
|
51
61
|
|
52
62
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html class="active_error">
|
3
3
|
<head>
|
4
|
-
<title>
|
4
|
+
<title>Errors</title>
|
5
5
|
<%= csrf_meta_tags %>
|
6
6
|
<%= csp_meta_tag %>
|
7
7
|
|
@@ -56,7 +56,8 @@
|
|
56
56
|
}
|
57
57
|
|
58
58
|
.active_error #notice {
|
59
|
-
color:
|
59
|
+
color: green;
|
60
|
+
margin: 0px;
|
60
61
|
}
|
61
62
|
|
62
63
|
.active_error header {
|
@@ -65,6 +66,7 @@
|
|
65
66
|
padding: 0.5em 1.5em;
|
66
67
|
display: flex;
|
67
68
|
flex-direction: row;
|
69
|
+
align-items: center;
|
68
70
|
margin-bottom: 0.83em;
|
69
71
|
}
|
70
72
|
|
data/lib/active_error/captor.rb
CHANGED
@@ -38,8 +38,7 @@ module ActiveError
|
|
38
38
|
|
39
39
|
def fault_attrs
|
40
40
|
{ backtrace: exception.backtrace, klass: exception.class.to_s,
|
41
|
-
controller:
|
42
|
-
action: parameters.to_h[:action] }
|
41
|
+
controller:, action: controller_action }
|
43
42
|
end
|
44
43
|
|
45
44
|
def template?
|
@@ -76,5 +75,15 @@ module ActiveError
|
|
76
75
|
fault.instances.create(headers:, parameters: request&.filtered_parameters,
|
77
76
|
url: request&.url)
|
78
77
|
end
|
78
|
+
|
79
|
+
def controller
|
80
|
+
parameters.to_h[:controller].presence ||
|
81
|
+
request.try(:controller_class).to_s.presence
|
82
|
+
end
|
83
|
+
|
84
|
+
def controller_action
|
85
|
+
parameters.to_h[:action].presence ||
|
86
|
+
request.try(:controller_instance).try(:action_name).presence
|
87
|
+
end
|
79
88
|
end
|
80
89
|
end
|
data/lib/active_error/engine.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module ActiveError
|
4
|
-
ActiveJobRequest = Struct.new(:parameters, :filtered_parameters,
|
4
|
+
ActiveJobRequest = Struct.new(:parameters, :filtered_parameters,
|
5
|
+
:controller_class, :env, :url)
|
5
6
|
|
6
7
|
class Engine < ::Rails::Engine
|
7
8
|
isolate_namespace ActiveError
|
@@ -13,7 +14,7 @@ module ActiveError
|
|
13
14
|
|
14
15
|
ActiveJob::Base.before_perform do
|
15
16
|
Rails.error.set_context(active_error_request:
|
16
|
-
ActiveJobRequest.new(serialize, serialize))
|
17
|
+
ActiveJobRequest.new(serialize, serialize, self.class.name))
|
17
18
|
rescue ActiveJob::SerializationError
|
18
19
|
without_args = { "job_class" => self.class.name,
|
19
20
|
"job_id" => job_id,
|
@@ -27,7 +28,7 @@ module ActiveError
|
|
27
28
|
"enqueued_at" => Time.now.utc.iso8601(9),
|
28
29
|
"scheduled_at" => scheduled_at&.utc&.iso8601(9) }
|
29
30
|
Rails.error.set_context(active_error_request:
|
30
|
-
ActiveJobRequest.new(without_args, without_args))
|
31
|
+
ActiveJobRequest.new(without_args, without_args, self.class.name))
|
31
32
|
end
|
32
33
|
end
|
33
34
|
end
|
@@ -4,6 +4,12 @@
|
|
4
4
|
|
5
5
|
module ActiveError
|
6
6
|
module ExceptionMock
|
7
|
+
class Klass < SimpleDelegator
|
8
|
+
def name
|
9
|
+
self
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
7
13
|
class Default < StandardError
|
8
14
|
# include ActiveSupport::Dependencies::Blamable
|
9
15
|
|
@@ -17,7 +23,7 @@ module ActiveError
|
|
17
23
|
end
|
18
24
|
|
19
25
|
def class
|
20
|
-
klass
|
26
|
+
Klass.new(klass)
|
21
27
|
end
|
22
28
|
|
23
29
|
attr_reader :backtrace, :backtrace_locations, :message, :cause,
|
data/lib/active_error/railtie.rb
CHANGED
@@ -3,7 +3,8 @@
|
|
3
3
|
module ActiveError
|
4
4
|
class ErrorSubscriber
|
5
5
|
def report(exception, context:, handled:, **_opts)
|
6
|
-
return if Rails.env.
|
6
|
+
return if Rails.env.development? || handled ||
|
7
|
+
ActiveError.ignored.to_a.include?(exception.class.to_s)
|
7
8
|
|
8
9
|
Captor.new(exception:, request: context[:active_error_request]).capture
|
9
10
|
end
|
data/lib/active_error/version.rb
CHANGED
data/lib/active_error.rb
CHANGED
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.1.0
|
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-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|