What I'd like to do is:
error 400..510 do
{:'400' => 'Bad Request', :'401' => ...}[<http-status-code>.to_s.to_sym]
end
where <http-status-code>
is some expression, evaluated to error code to be returned. One possible way the handler is triggered:
get '/test' do
401
end
Is this achievable?