aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/errors
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/errors')
-rw-r--r--app/views/errors/error.html.haml20
-rw-r--r--app/views/errors/error.json.jbuilder24
2 files changed, 44 insertions, 0 deletions
diff --git a/app/views/errors/error.html.haml b/app/views/errors/error.html.haml
new file mode 100644
index 0000000..8bc508f
--- /dev/null
+++ b/app/views/errors/error.html.haml
@@ -0,0 +1,20 @@
+%h1= response.status
+.lead
+ - case @exception
+ - when Aclog::Exceptions::TweetNotFound
+ ツイートが見つかりませんでした。
+ - when Aclog::Exceptions::UserNotFound
+ ユーザーが見つかりませんでした。
+ - when Aclog::Exceptions::UserNotRegistered
+ ユーザーは aclog に登録していません。
+ - when Aclog::Exceptions::UserProtected
+ ユーザーは非公開です。
+ - when Aclog::Exceptions::LoginRequired
+ このページの表示にはログインが必要です。
+ - when ActionController::RoutingError
+ 不正な URL です。
+ - else
+ - if response.status == 404
+ Not Found (Unknown)
+ - else
+ Internal Error (Unknown)
diff --git a/app/views/errors/error.json.jbuilder b/app/views/errors/error.json.jbuilder
new file mode 100644
index 0000000..8dab39a
--- /dev/null
+++ b/app/views/errors/error.json.jbuilder
@@ -0,0 +1,24 @@
+json.error do |json|
+ json.status response.status
+ case @exception
+ when Aclog::Exceptions::TweetNotFound
+ json.message "ツイートが見つかりませんでした。"
+ when Aclog::Exceptions::UserNotFound
+ json.message "ユーザーが見つかりませんでした。"
+ when Aclog::Exceptions::UserNotRegistered
+ json.message "ユーザーは aclog に登録していません。"
+ when Aclog::Exceptions::UserProtected
+ json.message "ユーザーは非公開です。"
+ when Aclog::Exceptions::LoginRequired
+ json.message "このページの表示にはログインが必要です。"
+ when ActionController::RoutingError
+ json.message "不正な URL です。"
+ else
+ if response.status == 404
+ json.message "Not Found (Unknown)"
+ else
+ json.message "Internal Error (Unknown)"
+ end
+ end
+ json.exception @exception.class.to_s
+end