email_error_reporter 0.1.0.pre → 0.2.0

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: 3b5bd625697e275051c8d51cee4ccbbe14faf8aa2cf2a09c18c225292d7dbf52
4
- data.tar.gz: 762d0ec2963ea8fe672a35732699a02c0d9da507b10e5cd100b2d5ea48650f04
3
+ metadata.gz: ee23af096b0b064122aea6388f90bc20f65aceda47d46bcda13dedae3336919a
4
+ data.tar.gz: 5b45ec6a4fd3be12fca5cdf207295516f74653b96d1e73d6f8b4d18788608702
5
5
  SHA512:
6
- metadata.gz: '0824b30d48460da923cadca8d6cb3ef9a2f3ec60f1ce1bba25a45cedc7c610331c477ea022a1929fc80091e4edf7bb3d5d0f02460b91488c7f0dfcac17166467'
7
- data.tar.gz: 5dd1577971dbcd095b4a3a4658433c98cd850a07c2521dae1bf0e9d513da36370ddc9ab6866f0c1fc14c4be7b81da03b3d596a795866eaefa314fe77dee03f58
6
+ metadata.gz: d7e432538fc9ff269c3c9c3e5c2a2faf2432a736279e5e0e47b694db7f909e3316bc753b1c1512a61465ed119efa440f54bdba2c10cff8b4b0ecd7d421310739
7
+ data.tar.gz: 0f3b60c8dd71f1e7437dc00a093dbf8d16d891b6be93827eca983ff1b9246e1bd427c443e8b84202063c35742a586ebaee6ea3424c80615e37c0cc7cc844108c
data/README.md CHANGED
@@ -28,6 +28,15 @@ All exceptions are reported automatically. No additional code required.
28
28
 
29
29
  Please consult the [official guides](https://guides.rubyonrails.org/error_reporting.html) for an introduction to the error reporting API.
30
30
 
31
+ ## Optional configuration
32
+
33
+ Set a custom from address.
34
+
35
+ ```ruby
36
+ # default: "no-reply@example.com"
37
+ config.email_error_reporter.from = "your-custom-email@example.com"
38
+ ```
39
+
31
40
  ## Test your setup
32
41
 
33
42
  You can use the built-in rake task `rake email_error_reporter:check` to check if everything works correctly in your setup.
@@ -1 +1,3 @@
1
- <li><%= frame %></li>
1
+ <tr>
2
+ <td style="font-family: monospace; padding: 2px;"><%= frame %></td>
3
+ </tr>
@@ -1 +1 @@
1
- <p>No backtrace available</p>
1
+ <tr><td>No backtrace available</td></tr>
@@ -1,6 +1,22 @@
1
- <h1><%= @error.class %></h1>
2
- <p><%= @error.message %></p>
1
+ <html>
2
+ <body style="max-width: 768px; margin: 0 auto;">
3
+ <h1 style="margin-top: 12px; font-family: sans-serif; font-size: 19px;"><%= @error.class %></h1>
4
+ <h2 style="font-family: sans-serif; font-size: 15px;"><%= @error.message %></h2>
3
5
 
4
- <div>
5
- <%= render(partial: "frame", collection: @backtrace) || render("no_backtrace") -%>
6
- </div>
6
+ <p data-test-id="source">Source: <%= @source ? @source : "No source present" %></p>
7
+ <p data-test-id="handled">Handled: <%= @handled ? "" : "❌" %></p>
8
+
9
+ <details style="margin-bottom: 12px;">
10
+ <summary>Stacktrace</summary>
11
+
12
+ <table data-test-id="backtrace" border="1" width="100%" style="margin-top: 12px; margin-bottom: 12px; border-collapse: collapse; border-color: #000000">
13
+ <%= render(partial: "frame", collection: @backtrace) || render("no_backtrace") -%>
14
+ </table>
15
+ </details>
16
+
17
+ <details>
18
+ <summary>Context</summary>
19
+ <pre data-test-id="context" style="font-family: mono; background: #eeeeee;"><code><%= @context %></code></pre>
20
+ </details>
21
+ </body>
22
+ </html>
@@ -4,6 +4,7 @@ module EmailErrorReporter
4
4
 
5
5
  config.email_error_reporter = ActiveSupport::OrderedOptions.new
6
6
  config.email_error_reporter.to = []
7
+ config.email_error_reporter.from = "no-reply@example.com"
7
8
 
8
9
  initializer "email_error_reporter.error_subscribe" do
9
10
  Rails.error.subscribe(Subscriber.new)
@@ -9,8 +9,15 @@ module EmailErrorReporter
9
9
 
10
10
  @backtrace = Array.wrap(error.backtrace)
11
11
 
12
+ severity_to_emoji = {
13
+ error: "🔥",
14
+ warning: "⚠️",
15
+ info: "ℹ️"
16
+ }
17
+
12
18
  mail(
13
- subject: "#{error.class}",
19
+ subject: "#{severity_to_emoji.fetch(@severity)} #{error.class}",
20
+ from: Rails.application.config.email_error_reporter.from,
14
21
  to: Rails.application.config.email_error_reporter.to
15
22
  )
16
23
  end
@@ -1,3 +1,3 @@
1
1
  module EmailErrorReporter
2
- VERSION = "0.1.0.pre"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: email_error_reporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Niklas Haeusele
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-03 00:00:00.000000000 Z
11
+ date: 2024-01-11 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.1.2
19
+ version: 7.0.0
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.1.2
26
+ version: 7.0.0
27
27
  description: Report your Rails errors via email.
28
28
  email:
29
29
  - niklas.haeusele@hey.com
@@ -59,7 +59,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - ">="
61
61
  - !ruby/object:Gem::Version
62
- version: '0'
62
+ version: 3.1.0
63
63
  required_rubygems_version: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - ">="