aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRhenium <rhenium@rhe.jp>2014-01-16 06:28:15 +0900
committerRhenium <rhenium@rhe.jp>2014-01-16 06:28:15 +0900
commit516e9d9f8a159ac92488405333e825e150e59708 (patch)
treeef7e68233620dbd9130302ea93e53377d8df4522
parentdeecdd041e3ac0114f5b8dc85169bdfacb8fc001 (diff)
downloadaclog-516e9d9f8a159ac92488405333e825e150e59708.tar.gz
fix behaviors on error
-rw-r--r--app/controllers/errors_controller.rb14
-rw-r--r--app/views/errors/render_error.html.haml2
2 files changed, 5 insertions, 11 deletions
diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb
index a9a88bd..3f20494 100644
--- a/app/controllers/errors_controller.rb
+++ b/app/controllers/errors_controller.rb
@@ -10,19 +10,15 @@ class ErrorsController < ApplicationController
when OAuth::Unauthorized
# /i/callback
redirect_to root_path
- when Aclog::Exceptions::TweetNotFound
- @status = 404
- @message = t("error.tweet_not_found")
- when Aclog::Exceptions::UserNotFound
- @status = 404
- @message = t("error.user_not_found")
when Aclog::Exceptions::LoginRequired
@status = 403
@message = t("error.login_required")
when Aclog::Exceptions::OAuthEchoUnauthorized
@status = 401
@message = t("error.oauth_echo_unauthorized")
- when ActionController::RoutingError
+ when ActionController::RoutingError,
+ ActiveRecord::RecordNotFound,
+ ActionView::MissingTemplate
@status = 404
@message = t("error.routing_error")
when Aclog::Exceptions::UserNotRegistered
@@ -52,9 +48,7 @@ class ErrorsController < ApplicationController
end
def force_format
- if request.format == :html
- request.format = (env["REQUEST_PATH"].scan(/\.([A-Za-z]+)$/).flatten.first || :html).to_sym
- end
+ request.format = (env["REQUEST_PATH"].scan(/\.([A-Za-z]+)$/).flatten.first || :html).to_sym
unless request.format == :html || request.format == :json
request.format = :html
diff --git a/app/views/errors/render_error.html.haml b/app/views/errors/render_error.html.haml
index 2d9f713..8aed2dc 100644
--- a/app/views/errors/render_error.html.haml
+++ b/app/views/errors/render_error.html.haml
@@ -1,5 +1,5 @@
- title "Error"
-- sidebar :i
+- sidebar @user ? :users : :i
%h1= response.status
.lead
= @message