solid_errors 0.7.0 → 0.7.1
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 +1 -6
- data/app/mailers/solid_errors/error_mailer.rb +9 -0
- data/app/models/solid_errors/backtrace.rb +1 -1
- data/app/models/solid_errors/occurrence.rb +4 -1
- data/app/views/layouts/solid_errors/{_style.html → _style.html.erb} +1 -1
- data/app/views/layouts/solid_errors/application.html.erb +1 -1
- data/app/views/solid_errors/occurrences/_collection.html.erb +4 -4
- data/lib/solid_errors/version.rb +1 -1
- data/lib/solid_errors.rb +10 -1
- metadata +15 -15
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f3f112f7c3ae7a71fa1f7d92be55cfa8e6fff8263fdff9a0c406c1db46c37126
|
|
4
|
+
data.tar.gz: fccfcd6e806e1f3fd17db5c89cc30f2c35302e6dc64b0a386f417bf1d28f8106
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f9415aa986a5ba6ff7491527f4cb053415df72fe73b585bd877f47e8e5ca869ba866210d9e32aac80373c43578b7efa59545dac9f82f808576f8ef80d60582b5
|
|
7
|
+
data.tar.gz: 1d0dd34c0920999496cd57e5729f3f18da0ca8c729b557d182cb9a47cfa3e8c038f1756a8d75fe5f08424e49d86db8050f85d2783e59751e7e778cc54d0282df
|
data/README.md
CHANGED
|
@@ -24,13 +24,8 @@
|
|
|
24
24
|
</a>
|
|
25
25
|
</p>
|
|
26
26
|
|
|
27
|
-
|
|
28
27
|
Solid Errors is a DB-based, app-internal exception tracker for Rails applications, designed with simplicity and performance in mind. It uses the new [Rails error reporting API](https://guides.rubyonrails.org/error_reporting.html) to store uncaught exceptions in the database, and provides a simple UI for viewing and managing exceptions.
|
|
29
28
|
|
|
30
|
-
> [!WARNING]
|
|
31
|
-
> The current point release of Rails (7.1.3.2) has a bug which severely limits the utility of Solid Errors. Exceptions raised during a web request *are not* reported to Rails' error reporter. There is a fix in the `main` branch, but it has not been released in a new point release. As such, Solid Errors is **not** production-ready unless you are running Rails from the `main` branch or until a new point version is released and you upgrade.
|
|
32
|
-
> The original bug report can be found [here](https://github.com/rails/rails/issues/51002) and the pull request making the fix is [here](https://github.com/rails/rails/pull/51050). I will try to backport the fix into the gem directly, but I haven't quite figured it out yet.
|
|
33
|
-
|
|
34
29
|
|
|
35
30
|
## Installation
|
|
36
31
|
|
|
@@ -80,7 +75,7 @@ production:
|
|
|
80
75
|
```
|
|
81
76
|
|
|
82
77
|
> [!NOTE]
|
|
83
|
-
> Calling `bin/rails solid_errors:install` will automatically add `config.solid_errors.connects_to = { database: { writing: :errors } }` to `config/environments/production.rb`, so no additional configuration is needed there (although you must make sure that you use the `errors` name in `database.yml` for this to match!). But if you want to use Solid Errors in a different environment (like staging or even development), you'll have to manually add that `config.solid_errors.connects_to` line to the respective environment file. And, as always, make sure that the name you're using for the database in `config/database.yml` matches the name you use in `config.solid_errors.connects_to`.
|
|
78
|
+
> Calling `bin/rails generate solid_errors:install` will automatically add `config.solid_errors.connects_to = { database: { writing: :errors } }` to `config/environments/production.rb`, so no additional configuration is needed there (although you must make sure that you use the `errors` name in `database.yml` for this to match!). But if you want to use Solid Errors in a different environment (like staging or even development), you'll have to manually add that `config.solid_errors.connects_to` line to the respective environment file. And, as always, make sure that the name you're using for the database in `config/database.yml` matches the name you use in `config.solid_errors.connects_to`.
|
|
84
79
|
|
|
85
80
|
Then run `db:prepare` in production to ensure the database is created and the schema is loaded.
|
|
86
81
|
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
module SolidErrors
|
|
2
2
|
# adapted from: https://github.com/codergeek121/email_error_reporter/blob/main/lib/email_error_reporter/error_mailer.rb
|
|
3
3
|
class ErrorMailer < (defined?(ActionMailer::Base) ? ActionMailer::Base : Object)
|
|
4
|
+
if defined?(ActionMailer::Base)
|
|
5
|
+
# A failure here reported as usual would email again and fail again, without end
|
|
6
|
+
rescue_from StandardError do |exception|
|
|
7
|
+
SolidErrors.without_emails do
|
|
8
|
+
Rails.error.report(exception, handled: true, source: "solid_errors.error_mailer")
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
4
13
|
def error_occurred(occurrence)
|
|
5
14
|
unless defined?(ActionMailer::Base)
|
|
6
15
|
raise "ActionMailer is not available. Make sure that you require \"action_mailer/railtie\" in application.rb"
|
|
@@ -2,6 +2,9 @@ module SolidErrors
|
|
|
2
2
|
class Occurrence < Record
|
|
3
3
|
belongs_to :error, class_name: "SolidErrors::Error"
|
|
4
4
|
|
|
5
|
+
# Adapters that report the json column as text (MariaDB) would otherwise store Hash#inspect
|
|
6
|
+
attribute :context, :json
|
|
7
|
+
|
|
5
8
|
after_create_commit :send_email, if: -> { SolidErrors.send_emails? && SolidErrors.email_to.present? }
|
|
6
9
|
after_create_commit :clear_resolved_errors, if: :should_clear_resolved_errors?
|
|
7
10
|
|
|
@@ -12,7 +15,7 @@ module SolidErrors
|
|
|
12
15
|
def parsed_backtrace
|
|
13
16
|
return @parsed_backtrace if defined? @parsed_backtrace
|
|
14
17
|
|
|
15
|
-
@parsed_backtrace = parse_backtrace(backtrace
|
|
18
|
+
@parsed_backtrace = parse_backtrace(backtrace&.split("\n"))
|
|
16
19
|
end
|
|
17
20
|
|
|
18
21
|
private
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<%= csrf_meta_tags %>
|
|
6
6
|
<%= csp_meta_tag %>
|
|
7
7
|
|
|
8
|
-
<%= render "layouts/solid_errors/style" %>
|
|
8
|
+
<%= render "layouts/solid_errors/style", nonce: content_security_policy_nonce %>
|
|
9
9
|
</head>
|
|
10
10
|
<body class="h-full flex flex-col pb-4">
|
|
11
11
|
<main class="grow container mx-auto mt-4">
|
|
@@ -20,25 +20,25 @@
|
|
|
20
20
|
|
|
21
21
|
<nav aria-label="Pages">
|
|
22
22
|
<% if (first_page = page.first) %>
|
|
23
|
-
<a href="<%= url_for(
|
|
23
|
+
<a href="<%= url_for(page: first_page, items: params[:items]) %>" aria-label="First" class="border border-black text-black bg-white py-1 px-2 cursor-pointer hover:bg-black hover:text-white">«</a>
|
|
24
24
|
<% else %>
|
|
25
25
|
<a role="link" aria-disabled="true" aria-label="First" class="border text-gray-500 bg-white py-1 px-2">«</a>
|
|
26
26
|
<% end %>
|
|
27
27
|
|
|
28
28
|
<% if (prev_page = page.prev) %>
|
|
29
|
-
<a href="<%= url_for(
|
|
29
|
+
<a href="<%= url_for(page: prev_page, items: params[:items]) %>" aria-label="Previous" class="border border-black text-black bg-white py-1 px-2 cursor-pointer hover:bg-black hover:text-white">‹</a>
|
|
30
30
|
<% else %>
|
|
31
31
|
<a role="link" aria-disabled="true" aria-label="Previous" class="border text-gray-500 bg-white py-1 px-2">‹</a>
|
|
32
32
|
<% end %>
|
|
33
33
|
|
|
34
34
|
<% if (next_page = page.next) %>
|
|
35
|
-
<a href="<%= url_for(
|
|
35
|
+
<a href="<%= url_for(page: next_page, items: params[:items]) %>" aria-label="Next" class="border border-black text-black bg-white py-1 px-2 cursor-pointer hover:bg-black hover:text-white">›</a>
|
|
36
36
|
<% else %>
|
|
37
37
|
<a role="link" aria-disabled="true" aria-label="Next" class="border text-gray-500 bg-white py-1 px-2">›</a>
|
|
38
38
|
<% end %>
|
|
39
39
|
|
|
40
40
|
<% if (last_page = page.last) %>
|
|
41
|
-
<a href="<%= url_for(
|
|
41
|
+
<a href="<%= url_for(page: last_page, items: params[:items]) %>" aria-label="Last" class="border border-black text-black bg-white py-1 px-2 cursor-pointer hover:bg-black hover:text-white">»</a>
|
|
42
42
|
<% else %>
|
|
43
43
|
<a role="link" aria-disabled="true" aria-label="Last" class="border text-gray-500 bg-white py-1 px-2">»</a>
|
|
44
44
|
<% end %>
|
data/lib/solid_errors/version.rb
CHANGED
data/lib/solid_errors.rb
CHANGED
|
@@ -30,7 +30,16 @@ module SolidErrors
|
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def send_emails?
|
|
33
|
-
send_emails && email_to.present?
|
|
33
|
+
send_emails && email_to.present? && !ActiveSupport::IsolatedExecutionState[:solid_errors_without_emails]
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Errors reported inside the block are recorded but never emailed
|
|
37
|
+
def without_emails
|
|
38
|
+
previous = ActiveSupport::IsolatedExecutionState[:solid_errors_without_emails]
|
|
39
|
+
ActiveSupport::IsolatedExecutionState[:solid_errors_without_emails] = true
|
|
40
|
+
yield
|
|
41
|
+
ensure
|
|
42
|
+
ActiveSupport::IsolatedExecutionState[:solid_errors_without_emails] = previous
|
|
34
43
|
end
|
|
35
44
|
end
|
|
36
45
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: solid_errors
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.7.
|
|
4
|
+
version: 0.7.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stephen Margheim
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: actionpack
|
|
@@ -15,70 +15,70 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: '7.
|
|
18
|
+
version: '7.1'
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: '7.
|
|
25
|
+
version: '7.1'
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: actionview
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
30
|
- - ">="
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '7.
|
|
32
|
+
version: '7.1'
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - ">="
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: '7.
|
|
39
|
+
version: '7.1'
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
41
41
|
name: activerecord
|
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
|
43
43
|
requirements:
|
|
44
44
|
- - ">="
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: '7.
|
|
46
|
+
version: '7.1'
|
|
47
47
|
type: :runtime
|
|
48
48
|
prerelease: false
|
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
51
|
- - ">="
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: '7.
|
|
53
|
+
version: '7.1'
|
|
54
54
|
- !ruby/object:Gem::Dependency
|
|
55
55
|
name: activesupport
|
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
|
57
57
|
requirements:
|
|
58
58
|
- - ">="
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: '7.
|
|
60
|
+
version: '7.1'
|
|
61
61
|
type: :runtime
|
|
62
62
|
prerelease: false
|
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
|
64
64
|
requirements:
|
|
65
65
|
- - ">="
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: '7.
|
|
67
|
+
version: '7.1'
|
|
68
68
|
- !ruby/object:Gem::Dependency
|
|
69
69
|
name: railties
|
|
70
70
|
requirement: !ruby/object:Gem::Requirement
|
|
71
71
|
requirements:
|
|
72
72
|
- - ">="
|
|
73
73
|
- !ruby/object:Gem::Version
|
|
74
|
-
version: '7.
|
|
74
|
+
version: '7.1'
|
|
75
75
|
type: :runtime
|
|
76
76
|
prerelease: false
|
|
77
77
|
version_requirements: !ruby/object:Gem::Requirement
|
|
78
78
|
requirements:
|
|
79
79
|
- - ">="
|
|
80
80
|
- !ruby/object:Gem::Version
|
|
81
|
-
version: '7.
|
|
81
|
+
version: '7.1'
|
|
82
82
|
- !ruby/object:Gem::Dependency
|
|
83
83
|
name: sqlite3
|
|
84
84
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -109,7 +109,7 @@ files:
|
|
|
109
109
|
- app/models/solid_errors/error.rb
|
|
110
110
|
- app/models/solid_errors/occurrence.rb
|
|
111
111
|
- app/models/solid_errors/record.rb
|
|
112
|
-
- app/views/layouts/solid_errors/_style.html
|
|
112
|
+
- app/views/layouts/solid_errors/_style.html.erb
|
|
113
113
|
- app/views/layouts/solid_errors/application.html.erb
|
|
114
114
|
- app/views/solid_errors/error_mailer/error_occurred.html.erb
|
|
115
115
|
- app/views/solid_errors/error_mailer/error_occurred.text.erb
|
|
@@ -145,14 +145,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
145
145
|
requirements:
|
|
146
146
|
- - ">="
|
|
147
147
|
- !ruby/object:Gem::Version
|
|
148
|
-
version: 2.
|
|
148
|
+
version: 3.2.0
|
|
149
149
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
150
|
requirements:
|
|
151
151
|
- - ">="
|
|
152
152
|
- !ruby/object:Gem::Version
|
|
153
153
|
version: '0'
|
|
154
154
|
requirements: []
|
|
155
|
-
rubygems_version:
|
|
155
|
+
rubygems_version: 4.0.16
|
|
156
156
|
specification_version: 4
|
|
157
157
|
summary: Database-backed Rails error subscriber
|
|
158
158
|
test_files: []
|