class Marten::Core::Validation::Error

Overview

Represents a validation error.

Included Modules

Defined in:

marten/core/validation/error.cr
marten/template/ext/marten/core/validation/error.cr

Constructors

Instance Method Summary

Macros inherited from module Marten::Template::CanDefineTemplateAttributes

template_attributes(*names) template_attributes

Constructor Detail

def self.new(message : String, type : String | Symbol, field : Nil | String | Symbol = nil) #

[View source]

Instance Method Detail

def field : String? #

[View source]
def message : String #

[View source]
def to_json(json : JSON::Builder) : Nil #

Serializes the error to JSON.

The generated object contains the #field, #type, and #message attributes. #field is null when the error is global.


[View source]
def type : String #

[View source]