diff --git a/app/mailers/solid_errors/error_mailer.rb b/app/mailers/solid_errors/error_mailer.rb
index 4c690b9..2d1f106 100644
--- a/app/mailers/solid_errors/error_mailer.rb
+++ b/app/mailers/solid_errors/error_mailer.rb
@@ -8,6 +8,8 @@ class ErrorMailer < (defined?(ActionMailer::Base) ? ActionMailer::Base : Object)
Rails.error.report(exception, handled: true, source: "solid_errors.error_mailer")
end
end
+
+ helper_method :occurrence_url
end
def error_occurred(occurrence)
@@ -26,5 +28,14 @@ def error_occurred(occurrence)
to: SolidErrors.email_to
)
end
+
+ private
+
+ # Optional: an app without default_url_options[:host] still gets the email, just unlinked
+ def occurrence_url
+ public_send(SolidErrors.url_helper_name).error_url(@error, **SolidErrors.url_options, anchor: "occurrence_#{@occurrence.id}")
+ rescue ArgumentError, NoMethodError, ActionController::UrlGenerationError
+ nil
+ end
end
end
diff --git a/app/views/solid_errors/error_mailer/error_occurred.html.erb b/app/views/solid_errors/error_mailer/error_occurred.html.erb
index 8e63065..5d2bdf1 100644
--- a/app/views/solid_errors/error_mailer/error_occurred.html.erb
+++ b/app/views/solid_errors/error_mailer/error_occurred.html.erb
@@ -2,16 +2,169 @@
Solid Errors | <%= @error.severity_emoji %> <%= @error.exception_class %>
<%= render "layouts/solid_errors/style" %>
+
- <%= render "solid_errors/errors/error",
- error: @error,
- show_actions: false %>
-
-
+
- <%= render "solid_errors/occurrences/occurrence",
- occurrence: @occurrence %>
+ <%= @error.message %>
+
+
+
+ | Severity |
+ <%= @error.severity_emoji %> <%= @error.severity %> |
+
+
+ | Status |
+ <%= @error.status_emoji %> <%= @error.status %> |
+
+
+ | Occurred at |
+ <%= @occurrence.created_at.strftime("%Y-%m-%d %H:%M:%S %Z") %> |
+
+
+
+ <% if @occurrence.context&.any? %>
+ Context
+
+
+
+ | Key |
+ Value |
+
+
+
+ <% @occurrence.context.each do |key, value| %>
+
+ | <%= key %> |
+ <%= value %> |
+
+ <% end %>
+
+
+ <% end %>
+
+ Backtrace
+
+ <% @occurrence.parsed_backtrace.lines.each_with_index do |line, i| %>
+
+ <% if line.filtered_file %>
+<%= File.dirname(line.filtered_file) %>/<%= File.basename(line.filtered_file) %>:<%= line.filtered_number %> in <%= line.filtered_method %>
+ <% else %>
+<%= line.unparsed_line %>
+ <% end %>
+
+ <% end %>
+