1
無論出於何種原因,我無法弄清楚爲什麼我不斷收到此錯誤。在新的日誌中顯示8次,這很奇怪。缺少模板錯誤 - 佈局存在時
我在本地安裝的生產環境中運行WEBrick。但是,在AWS上運行Puma的實際生產環境中,我收到了相同的錯誤。
ruby 2.1.4p265
rails 4.2.7.1
堆棧跟蹤
Error during failsafe response: Missing template errors/internal_server_error,
application/internal_server_error with {:locale=>[:en], :formats=>[:png], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby]}. Searched in:
* "~/Rails/ReturnLabel/return_label/app/views"
* "~/.rvm/gems/[email protected]_disposition/gems/devise-3.5.5/app/views"
應用/視圖/錯誤
$ ls app/views/errors/
./ _error.html.erb internal_server_error.html.erb no_label.html.erb unsupported_country.html.erb
../ expired_order.html.erb invalid.html.erb not_found.html.erb
errors_controller.rb
class ErrorsController < ApplicationController
def expired_order
@error = :expired_order
render(status: 503)
end
def unsupported_country
@error = :unsupported_country
render(status: 503)
end
def invalid
@error = :invalid
render(status: 400)
end
def not_found
@error = :not_found
render(status: 404)
end
def internal_server_error
@error = :internal_server_error
render(status: 500)
end
def no_label
@error = :no_label
render(status: 503)
end
end
的routes.rb
match '/404', to: 'errors#not_found', as: 'not_found', via: :all
match '/500', to: 'errors#internal_server_error', as: 'internal_server_error', via: :all
match '/unsupported_country', to: 'errors#unsupported_country', via: :all
match '/expired_order', to: 'errors#expired_order', via: :all
match '/invalid', to: 'errors#invalid', via: :all
match '/no_label', to: 'errors#no_label', via: :all
...
# END OF FILE
match '*path', to: 'errors#not_found', via: :all
查看代碼
internal_server_error.html.erb
<header class="header-span-single-line styled">
<div class="text-center animated shake">
<span><%= t('error.header.title') %></span>
<br>
</div>
</header>
<div class="container animated bounceInUp">
<div class="jumbotron">
<div class="container">
<%= render 'error' %>
</div>
</div>
</div>
_error.html.erb
<% error_text = t("error.#{@error}") %>
<h1><%= error_text[:title] %></h1>
<p class="text-white"><%= error_text[:body] %></p>
<hr/>
<p><strong><%= t('error.contact.title') %></strong></p>
<ul class="list-padding">
<li class="list-unstyled">
<p class="cs-p"><%= t('error.contact.phone') %></p>
</li>
<li class="list-unstyled">
<p class="cs-p"><%= t('error.contact.email.title') %>
<a class="branded-link branded-link-dark" target="_blank" href="<%= t('error.contact.email.href') %>"><%= t('error.contact.email.value') %></a>
</p>
</li>
</ul>
<%= link_to t('error.button'), :root, :class => 'btn btn-warning btn-lg btn-dark' %>
不知道其他人在這裏做什麼。我錯過了什麼?
好奇,爲什麼格式是'png'? – dubadub
說實話我不知道! –
這是通過渲染在某個視圖中調用的嗎?你可以發佈視圖的代碼,這是調用?此外,它以前是否工作過,現在已經破產? –