aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/errors/error.json.jbuilder
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/errors/error.json.jbuilder')
-rw-r--r--app/views/errors/error.json.jbuilder24
1 files changed, 24 insertions, 0 deletions
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