blob: 4169eab7e6e5712b0bb91a9c444eb43a2420af68 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
class ErrorsController < ApplicationController
layout "index"
def render_error
@exception = env["action_dispatch.exception"]
@status = ActionDispatch::ExceptionWrapper.new(env, @exception).status_code
@title = "?"
case @exception
when OAuth::Unauthorized
# /i/callback
redirect_to root_path
when Aclog::Exceptions::TweetNotFound
render "error", status: 404
when Aclog::Exceptions::UserNotFound
render "error", status: 404
when Aclog::Exceptions::UserNotRegistered
render "error", status: 404
when Aclog::Exceptions::UserProtected
render "error", status: 403
when Aclog::Exceptions::LoginRequired
render "error", status: 403
when ActionController::RoutingError
render "error", status: 404
else
render "error", status: 500
end
end
end
|