diff options
Diffstat (limited to 'app/controllers/errors_controller.rb')
-rw-r--r-- | app/controllers/errors_controller.rb | 14 |
1 files changed, 4 insertions, 10 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 |