diff options
-rw-r--r-- | app/controllers/errors_controller.rb | 14 | ||||
-rw-r--r-- | app/views/errors/render_error.html.haml | 2 |
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 |