class Kemal::InvalidParameterError

Overview

Exception raised when a parameter is present but its value cannot be converted to the declared type.

This error is raised when a controller method declares a typed parameter and the value exists in the request but fails type coercion (e.g. "foo" for an Int32, an unrecognised enum member, or an invalid boolean literal).

Example

@[Get("/users")]
def index(age : Int32)
  "Age: #{age}"
end
# GET /users?age=foo will raise Kemal::InvalidParameterError

Defined in:

kemal/from_www_form.cr

Constructors

Constructor Detail

def self.new(param_name : String, expected_type : String, value) #

[View source]