-
-
Notifications
You must be signed in to change notification settings - Fork 108
Rambulanceを使って404/500/422ページを整備 #1702
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
a39bdf6
a4ce6e1
548d72a
7c19b40
a456487
44d493b
677d005
62ad7c3
4b52ff7
7e4737c
9dac37e
c0d871a
092c3dd
8e7f468
0103961
21dbe7b
ee6d1de
4e8612b
2222744
22c107b
285999d
5d202b7
d064907
5a6566d
ca186cb
50bd22e
c50c127
4457879
f86b750
29c6cac
48b231e
8cd758d
52bc61d
619801e
4df3a8a
cc5dad9
561e698
37ed1c4
9b25662
ac24ce1
3736488
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class ErrorsController < ApplicationController | ||
layout 'application' # エラー画面にも通常のアプリと同じレイアウトを適用 | ||
|
||
def not_found | ||
render status: 404 # このアクションでは app/views/errors/not_found.html.erb が使用されます | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 他所も同様ですが、
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 統一しました🛠 |
||
end | ||
|
||
def internal_server_error | ||
render status: 500 # このアクションでは app/views/errors/internal_server_error.html.erb が使用されます | ||
end | ||
|
||
def unprocessable_entity | ||
render status: 422 # このアクションでは app/views/errors/unprocessable_entity.html.erb が使用されます | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<p> | ||
フィードバックなどあれば [email protected] にメールしていただくか、 | ||
<br> | ||
もしくは | ||
<a href="https://github.com/coderdojo-japan/coderdojo.jp/issues/" target="_blank" rel="noopener">GitHub Issue</a> | ||
に書いていただけると嬉しいです (>人< )✨ | ||
</p> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<section id="timeline" class="text-center grayscale-bg" style="padding-bottom: 100px;"> | ||
<br> | ||
<h3 class="text-center"> | ||
<a href="https://twitter.com/search?vertical=default&q=dojocon%20OR%20coderdojo%20OR%20%E3%82%B3%E3%83%BC%E3%83%80%E3%83%BC%E9%81%93%E5%A0%B4%20lang%3Aja" target="_blank" rel="noopener"> | ||
🐣 最近の情報発信 | ||
</a> | ||
</h3> | ||
<br> | ||
<div class="twitter-timeline-wrapper"> | ||
<a class="twitter-timeline" href="https://twitter.com/CoderDojoJapan?ref_src=twsrc%5Etfw" | ||
data-lang="ja" | ||
data-chrome="noheader nofooter noborders" | ||
data-dnt="true" | ||
data-width="500" | ||
data-tweet-limit="5"> | ||
@CoderDojoJapan アカウントのタイムライン | ||
</a> | ||
</div> | ||
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> | ||
</section> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<div id="top" class="title text-center"> | ||
<i class="cd cd-logo"></i> | ||
<h1>CoderDojo Japan</h1> | ||
<p>子どものためのプログラミング道場</p> | ||
<br> | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<% provide(:title, "予期しないエラーが発生しました 😵💫") %> | ||
<% provide(:desc, "申し訳ありません。サーバーで問題が発生しています。") %> | ||
|
||
<%= render 'errors/header' %> | ||
|
||
<section class="introduction text-center list"> | ||
<h2> | ||
予期しないエラーが発生しました 😵💫 | ||
</h2> | ||
<p> | ||
現在、問題を調査しています。しばらくしてからもう一度お試しください。 | ||
<br> | ||
</p> | ||
<%= render 'errors/feedback_notice' %> | ||
</section> | ||
|
||
<%= render 'errors/footer_links_and_timeline' %> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,7 @@ | ||
<% provide(:title, "ページが見つかりませんでした... 🥺💦") %> | ||
<% provide(:desc, "ページが削除された可能性があります 🤔💭") %> | ||
|
||
<div id="top" class="title text-center"> | ||
<i class="cd cd-logo"></i> | ||
<h1>CoderDojo Japan</h1> | ||
<p>子どものためのプログラミング道場</p> | ||
<br> | ||
</div> | ||
<%= render 'errors/header' %> | ||
|
||
<section class="introduction text-center list"> | ||
<h2> | ||
|
@@ -16,23 +11,7 @@ | |
ページが削除された可能性があります 🤔💭 | ||
<br> | ||
</p> | ||
<p> | ||
フィードバックなどあれば [email protected] にメールしていただくか、 | ||
<br> | ||
もしくは | ||
<a href="https://github.com/coderdojo-japan/coderdojo.jp/issues/">GitHub Issue</a> | ||
に書いていただけると嬉しいです (>人< )✨ | ||
</p> | ||
<%= render 'errors/feedback_notice' %> | ||
</section> | ||
|
||
<section id="timeline" class="text-center grayscale-bg" style="padding-bottom: 100px;"> | ||
<br> | ||
<h3 class="text-center"> | ||
<a href="https://twitter.com/search?vertical=default&q=dojocon%20OR%20coderdojo%20OR%20%E3%82%B3%E3%83%BC%E3%83%80%E3%83%BC%E9%81%93%E5%A0%B4%20lang%3Aja" target="_blank" rel="noopener">🐣 最近の情報発信</a> | ||
</h3> | ||
<br> | ||
<div class="twitter-timeline-wrapper"> | ||
<a class="twitter-timeline" href="https://twitter.com/CoderDojoJapan?ref_src=twsrc%5Etfw" data-lang="ja" data-chrome="noheader nofooter noborders" data-dnt="true" data-width="500" data-tweet-limit="5">@CoderDojoJapan アカウントのタイムライン</a> | ||
</div> | ||
<script async="" await="" src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> | ||
</section> | ||
<%= render 'errors/footer_links_and_timeline' %> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Error 専用の Partial にしては個々に分割しすぎな印象なので (個々に分けるメリットより個々に分けたことよる煩雑さが上回って僕がメンテするとき辛いので)、 共通化できる箇所のみを1つの Partial にまとめる ようにしていただけると助かります!(>人< )✨ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<% provide(:title, "リクエストが処理できませんでした… 😢") %> | ||
<% provide(:desc, "入力内容に誤りがあるか、リクエストが正しく送信されなかった可能性があります。") %> | ||
|
||
<%= render 'errors/header' %> | ||
|
||
<section class="introduction text-center list"> | ||
<h2> | ||
リクエストが処理できませんでした… 😢 | ||
</h2> | ||
<p> | ||
入力内容に誤りがあるか、リクエストが正しく送信されなかった可能性があります。 | ||
<br> | ||
</p> | ||
<%= render 'errors/feedback_notice' %> | ||
</section> | ||
|
||
<%= render 'errors/footer_links_and_timeline' %> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,12 +4,25 @@ | |
include Rambulance::TestHelper | ||
|
||
describe "Error requests" do | ||
it 'should render a corresponding error page' do | ||
it 'renders the 404 error page' do | ||
with_exceptions_app do | ||
get '/does_not_exist' | ||
end | ||
expect(response.status).to eq(404) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 「子どものためのプログラミング道場」など、必ず表示されるテキストが存在するかも確認しておくと、さらに安心できそうです👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. テストを追加しました🙌 |
||
end | ||
|
||
assert_equal 404, response.status | ||
it 'renders the 422 error page' do | ||
with_exceptions_app do | ||
get '/trigger_422' | ||
end | ||
expect(response.status).to eq(422) | ||
end | ||
|
||
it 'renders the 500 error page' do | ||
with_exceptions_app do | ||
get '/trigger_500' | ||
end | ||
expect(response.status).to eq(500) | ||
end | ||
end | ||
end |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
このコメントはカットして良さそうです👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ご指摘ありがとうございます!
こちらのコミットで対応済みです🙌
4b52ff7