email_error_reporter 0.1.0.pre → 0.1.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: 8e8f1858125082a54222230c31cc9f86977225bb52e4d58250415c6b0cb7c47d
4
+ data.tar.gz: 2c6a173d38e6d7b58cfea1291dfd5aa2dce6dd5b31e5907fe72772c96055ab8f
5
5
  SHA512:
6
- metadata.gz: '0824b30d48460da923cadca8d6cb3ef9a2f3ec60f1ce1bba25a45cedc7c610331c477ea022a1929fc80091e4edf7bb3d5d0f02460b91488c7f0dfcac17166467'
7
- data.tar.gz: 5dd1577971dbcd095b4a3a4658433c98cd850a07c2521dae1bf0e9d513da36370ddc9ab6866f0c1fc14c4be7b81da03b3d596a795866eaefa314fe77dee03f58
6
+ metadata.gz: 928f4ed5561244626c6968949f531931ac2d24daa8d85912346d6c80ea4b06789a678af0f03767c4170fe8d0021392a09ab60dafa1a5d4a50827e41893460376
7
+ data.tar.gz: e4c5f4044e603434cd92504f37c386af900cbb1351abc6b7270a34268aed6d4a2d73a05b138f583b37ff9229583bd6d2c899c0fa8bf8321a989b833eadee5c74
data/README.md CHANGED
@@ -1,43 +1,28 @@
1
1
  # EmailErrorReporter
2
+ Short description and motivation.
2
3
 
3
- > [!CAUTION]
4
- > This is a very early prototype
5
-
6
- `email_error_reporter` uses the new [Rails error reporting API](https://guides.rubyonrails.org/error_reporting.html#error-reporting) to send emails whenever an exception is being reported. It works out of the box with HTTP requests, jobs and the rails runner.
4
+ ## Usage
5
+ How to use my plugin.
7
6
 
8
7
  ## Installation
8
+ Add this line to your application's Gemfile:
9
9
 
10
- Add the gem:
10
+ ```ruby
11
+ gem "email_error_reporter"
12
+ ```
11
13
 
14
+ And then execute:
12
15
  ```bash
13
- bundle add email_error_reporter && bundle install
16
+ $ bundle
14
17
  ```
15
18
 
16
- and configure the email addresses that should receive an email in the case of an exception:
17
-
18
- ```ruby
19
- # application.rb
20
- config.email_error_reporter.to = ["youremail@example.com"]
19
+ Or install it yourself as:
20
+ ```bash
21
+ $ gem install email_error_reporter
21
22
  ```
22
23
 
23
- `email_error_reporter` will reuse your environment specific ActionMailer configuration for delivering emails.
24
-
25
- ## Usage
26
-
27
- All exceptions are reported automatically. No additional code required.
28
-
29
- Please consult the [official guides](https://guides.rubyonrails.org/error_reporting.html) for an introduction to the error reporting API.
30
-
31
- ## Test your setup
32
-
33
- You can use the built-in rake task `rake email_error_reporter:check` to check if everything works correctly in your setup.
34
-
35
- If you're using Kamal, you can run the following command to test the setup in production:
36
-
37
- ```
38
- kamal app exec -p 'bundle exec rake email_error_reporter:test_email'
39
- ```
24
+ ## Contributing
25
+ Contribution directions go here.
40
26
 
41
27
  ## License
42
-
43
28
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,4 @@
1
+ module EmailErrorReporter
2
+ class Railtie < ::Rails::Railtie
3
+ end
4
+ end
@@ -1,3 +1,3 @@
1
1
  module EmailErrorReporter
2
- VERSION = "0.1.0.pre"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -1,10 +1,6 @@
1
1
  require "email_error_reporter/version"
2
- require "email_error_reporter/engine"
2
+ require "email_error_reporter/railtie"
3
3
 
4
4
  module EmailErrorReporter
5
- extend ActiveSupport::Autoload
6
-
7
- autoload :ErrorMailer
8
- autoload :Subscriber
9
- autoload :ExceptionSerializer
5
+ # Your code goes here...
10
6
  end
@@ -1,12 +1,4 @@
1
- desc "Report a test exception"
2
- namespace :email_error_reporter do
3
- task check: :environment do
4
- Rails.error.handle { raise "This is a test!" }
5
- $stdout.puts <<~TXT
6
- Test exception triggered.
7
-
8
- Recipients:
9
- #{Rails.application.config.email_error_reporter.to.join("\n").gsub(/^/, "* ")}
10
- TXT
11
- end
12
- end
1
+ # desc "Explaining what the task does"
2
+ # task :email_error_reporter do
3
+ # # Task goes here
4
+ # 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.1.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-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -34,14 +34,8 @@ files:
34
34
  - MIT-LICENSE
35
35
  - README.md
36
36
  - Rakefile
37
- - app/views/email_error_reporter/error_mailer/_frame.html.erb
38
- - app/views/email_error_reporter/error_mailer/_no_backtrace.html.erb
39
- - app/views/email_error_reporter/error_mailer/error.html.erb
40
37
  - lib/email_error_reporter.rb
41
- - lib/email_error_reporter/engine.rb
42
- - lib/email_error_reporter/error_mailer.rb
43
- - lib/email_error_reporter/exception_serializer.rb
44
- - lib/email_error_reporter/subscriber.rb
38
+ - lib/email_error_reporter/railtie.rb
45
39
  - lib/email_error_reporter/version.rb
46
40
  - lib/tasks/email_error_reporter_tasks.rake
47
41
  homepage: https://github.com/codergeek121/email_error_reporter
@@ -1 +0,0 @@
1
- <li><%= frame %></li>
@@ -1 +0,0 @@
1
- <p>No backtrace available</p>
@@ -1,6 +0,0 @@
1
- <h1><%= @error.class %></h1>
2
- <p><%= @error.message %></p>
3
-
4
- <div>
5
- <%= render(partial: "frame", collection: @backtrace) || render("no_backtrace") -%>
6
- </div>
@@ -1,17 +0,0 @@
1
- module EmailErrorReporter
2
- class Engine < ::Rails::Engine
3
- isolate_namespace EmailErrorReporter
4
-
5
- config.email_error_reporter = ActiveSupport::OrderedOptions.new
6
- config.email_error_reporter.to = []
7
-
8
- initializer "email_error_reporter.error_subscribe" do
9
- Rails.error.subscribe(Subscriber.new)
10
- end
11
-
12
- # ActiveJob cannot (de)-serialize exceptions by default
13
- initializer "email_error_reporter.exception_serializer" do |app|
14
- app.config.active_job.custom_serializers << ExceptionSerializer
15
- end
16
- end
17
- end
@@ -1,18 +0,0 @@
1
- module EmailErrorReporter
2
- class ErrorMailer < ActionMailer::Base
3
- def error(error, handled:, severity:, context:, source: nil)
4
- @error = error
5
- @handled = handled
6
- @severity = severity
7
- @context = context
8
- @source = source
9
-
10
- @backtrace = Array.wrap(error.backtrace)
11
-
12
- mail(
13
- subject: "#{error.class}",
14
- to: Rails.application.config.email_error_reporter.to
15
- )
16
- end
17
- end
18
- end
@@ -1,23 +0,0 @@
1
- module EmailErrorReporter
2
- class ExceptionSerializer < ActiveJob::Serializers::ObjectSerializer
3
- def serialize(exception)
4
- super(
5
- exception_class: exception.class.to_s,
6
- message: exception.message,
7
- backtrace: exception.backtrace
8
- )
9
- end
10
-
11
- def deserialize(hash)
12
- hash[:exception_class].constantize.new(hash[:message]).tap do |e|
13
- e.set_backtrace(hash[:backtrace])
14
- end
15
- end
16
-
17
- private
18
-
19
- def klass
20
- Exception
21
- end
22
- end
23
- end
@@ -1,11 +0,0 @@
1
- module EmailErrorReporter
2
- class Subscriber
3
- def report(error, handled:, severity:, context:, source: nil)
4
- ErrorMailer.error(error,
5
- handled: handled,
6
- context: context,
7
- severity: severity,
8
- source: source).deliver_later
9
- end
10
- end
11
- end