Files
danbooru/app/views/static/error.json.erb
evazion 935cefd27e API: on error, include backtrace in json response.
Incidentally fixes issue with error responses inside /sources.json not
including the usual `{"success": false}`.
2017-03-16 18:11:43 -05:00

10 lines
402 B
Plaintext

<% if @error_message %>
{"success": false, "message": <%= raw @error_message.encode("utf-8", {:invalid => :replace, :undef => :replace, :replace => "?"}).to_json %>}
<% else %>
{
"success": false,
"message": <%= raw @exception.to_s.encode("utf-8", {:invalid => :replace, :undef => :replace, :replace => "?"}).to_json %>,
"backtrace": <%= raw @exception.backtrace.to_json %>
}
<% end %>