annotation ActionController::Route::Exception

Overview

define a handler for common errors

@[AC::Route::Exception(AC::Route::Param::MissingError, status_code: HTTP::Status::UNPROCESSABLE_ENTITY)]
@[AC::Route::Exception(AC::Route::Param::ValueError, status_code: HTTP::Status::BAD_REQUEST)]
def invalid_param(error) : AC::Error::ParameterResponse
  AC::Error::ParameterResponse.new error: error.message.as(String), parameter: error.parameter, restriction: error.restriction
end

Defined in:

action-controller/router/builder.cr