Clean backtraces in uploads/show, static/error.json.
This commit is contained in:
8
app/javascript/src/styles/specific/error.scss
Normal file
8
app/javascript/src/styles/specific/error.scss
Normal file
@@ -0,0 +1,8 @@
|
||||
ul.backtrace {
|
||||
font-family: monospace;
|
||||
font-size: 1.2em;
|
||||
list-style-type: none;
|
||||
background: #EEE;
|
||||
padding: 1em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
7
app/views/static/_backtrace.html.erb
Normal file
7
app/views/static/_backtrace.html.erb
Normal file
@@ -0,0 +1,7 @@
|
||||
<%# backtrace %>
|
||||
|
||||
<ul class="backtrace">
|
||||
<% Rails.backtrace_cleaner.clean(backtrace).each do |b| %>
|
||||
<li class="backtrace-line"><%= b %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
@@ -1,11 +1,8 @@
|
||||
<% if CurrentUser.user.try(:is_builder?) && @exception.present? %>
|
||||
<h1><%= @exception.class.to_s %> exception raised</h1>
|
||||
<ul style="font-family: monospace; font-size: 1.2em; list-style-type: none;">
|
||||
<li><%= @exception.message.dup.force_encoding("utf-8") %></li>
|
||||
<%- Rails.backtrace_cleaner.clean(@exception.backtrace).each do |b| -%>
|
||||
<li style="list-style-type: none;"><%= b %></li>
|
||||
<%- end -%>
|
||||
</ul>
|
||||
<h1><%= @exception.class.to_s %> exception raised</h1>
|
||||
|
||||
<p><%= @exception.message.dup.force_encoding("utf-8") %></p>
|
||||
<%= render "static/backtrace", backtrace: @exception.backtrace %>
|
||||
<% elsif @error_message %>
|
||||
<p><%= @error_message %></p>
|
||||
<% else %>
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
{
|
||||
"success": false,
|
||||
"message": <%= raw @exception.to_s.encode("utf-8", {:invalid => :replace, :undef => :replace, :replace => "?"}).to_json %>,
|
||||
"backtrace": <%= raw @exception.backtrace.to_json %>
|
||||
"backtrace": <%= raw Rails.backtrace_cleaner.clean(@exception.backtrace).to_json %>
|
||||
}
|
||||
<% end %>
|
||||
|
||||
@@ -30,11 +30,7 @@
|
||||
<% else %>
|
||||
<p>An error occurred: <%= render_status(@upload) %></p>
|
||||
<% if CurrentUser.user.is_builder? %>
|
||||
<ul>
|
||||
<% @upload.backtrace.to_s.split(/\n/).each do |line| %>
|
||||
<li><%= line %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<%= render "static/backtrace", backtrace: @upload.backtrace.to_s.split(/\n/) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user