diff --git a/app/javascript/src/styles/specific/error.scss b/app/javascript/src/styles/specific/error.scss new file mode 100644 index 000000000..c629edbdf --- /dev/null +++ b/app/javascript/src/styles/specific/error.scss @@ -0,0 +1,8 @@ +ul.backtrace { + font-family: monospace; + font-size: 1.2em; + list-style-type: none; + background: #EEE; + padding: 1em; + margin-bottom: 1em; +} diff --git a/app/views/static/_backtrace.html.erb b/app/views/static/_backtrace.html.erb new file mode 100644 index 000000000..c92a33081 --- /dev/null +++ b/app/views/static/_backtrace.html.erb @@ -0,0 +1,7 @@ +<%# backtrace %> + + diff --git a/app/views/static/error.html.erb b/app/views/static/error.html.erb index ae6df8f9f..648971206 100644 --- a/app/views/static/error.html.erb +++ b/app/views/static/error.html.erb @@ -1,11 +1,8 @@ <% if CurrentUser.user.try(:is_builder?) && @exception.present? %> -

<%= @exception.class.to_s %> exception raised

- +

<%= @exception.class.to_s %> exception raised

+ +

<%= @exception.message.dup.force_encoding("utf-8") %>

+ <%= render "static/backtrace", backtrace: @exception.backtrace %> <% elsif @error_message %>

<%= @error_message %>

<% else %> diff --git a/app/views/static/error.json.erb b/app/views/static/error.json.erb index e2fa831d9..ddd0c6852 100644 --- a/app/views/static/error.json.erb +++ b/app/views/static/error.json.erb @@ -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 %> diff --git a/app/views/uploads/show.html.erb b/app/views/uploads/show.html.erb index 414ed9a40..db7101dea 100644 --- a/app/views/uploads/show.html.erb +++ b/app/views/uploads/show.html.erb @@ -30,11 +30,7 @@ <% else %>

An error occurred: <%= render_status(@upload) %>

<% if CurrentUser.user.is_builder? %> - + <%= render "static/backtrace", backtrace: @upload.backtrace.to_s.split(/\n/) %> <% end %> <% end %>