5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-15 04:51:43 +00:00

enviar los reportes

This commit is contained in:
f 2021-03-19 20:50:11 -03:00
parent 39fc094790
commit 65af7da0fb
3 changed files with 14 additions and 12 deletions

View file

@ -12,8 +12,7 @@ class BacktraceJob < ApplicationJob
@site_id = site_id @site_id = site_id
@params = params @params = params
return if files.empty? unless files.empty?
params['errors'].each do |error| params['errors'].each do |error|
error['backtrace'].each do |backtrace| error['backtrace'].each do |backtrace|
offset = SourceMap::Offset.new(backtrace['line'], backtrace['column']) offset = SourceMap::Offset.new(backtrace['line'], backtrace['column'])
@ -26,11 +25,12 @@ class BacktraceJob < ApplicationJob
backtrace['column'] = mapping.original.column backtrace['column'] = mapping.original.column
end end
end end
end
begin begin
raise BacktraceException, params['errors']&.first&.dig('message') raise BacktraceException, params['errors']&.first&.dig('message')
rescue BacktraceException => e rescue BacktraceException => e
ExceptionNotifier.notify_exception(e, data: { site: site.name, params: params, backtrace: true }) ExceptionNotifier.notify_exception(e, data: { site: site.name, params: params, _backtrace: true })
end end
end end

View file

@ -1,3 +1,5 @@
<% unless @data[:_backtrace] %>
``` ```
<%= raw @backtrace.join("\n") %> <%= raw @backtrace.join("\n") %>
``` ```
<% end %>

View file

@ -1,4 +1,4 @@
<% if @data['backtrace'] %> <% if @data[:_backtrace] %>
<% @data.dig(:params, 'errors')&.each do |error| %> <% @data.dig(:params, 'errors')&.each do |error| %>
# <%= error['type'] %>: <%= error['message'] %> # <%= error['type'] %>: <%= error['message'] %>