class CrSerializer::Exceptions::ValidationException
- CrSerializer::Exceptions::ValidationException
- Exception
- Reference
- Object
Overview
Exception thrown when an object is not valid and raise_on_invalid
is true.
Defined in:
CrSerializer/exceptions/validation_exception.crConstructors
Instance Method Summary
-
#to_json : String
Returns a validation failed 400 JSON error for easy error handling with REST APIs.
-
#to_s : String
Returns failed valications as a string.
Instance methods inherited from class Object
to_json(io : IO, serialization_groups : Array(String), expand : Array(String))to_json(serialization_groups : Array(String) = ["default"], expand : Array(String) = [] of String) : String to_json, to_pretty_json(indent : String = " ", serialization_groups : Array(String) = ["default"], expand : Array(String) = [] of String)
to_pretty_json(io : IO, serialization_groups : Array(String), expand : Array(String), indent : String = " ") to_pretty_json, to_yaml(serialization_groups : Array(String) = ["default"], expand : Array(String) = [] of String) : String to_yaml
Constructor Detail
Instance Method Detail
def to_json : String
#
Returns a validation failed 400 JSON error for easy error handling with REST APIs.
{
"code": 400,
"message": "Validation tests failed",
"errors": [
"'password' should not be blank",
"'age' should be greater than 1",
],
}
def to_s : String
#
Returns failed valications as a string.
Validation tests failed: `'password' should not be blank`, `'age' should be greater than 1`.