class GraphqlRails::ValidationError

GraphQL error that is raised when invalid data is given

Attributes

field[R]
short_message[R]

Public Class Methods

new(short_message, field) click to toggle source
Calls superclass method
# File lib/graphql_rails/errors/validation_error.rb, line 8
def initialize(short_message, field)
  super([field.presence&.to_s&.humanize, short_message].compact.join(' '))
  @short_message = short_message
  @field = field
end

Public Instance Methods

to_h() click to toggle source
Calls superclass method GraphqlRails::ExecutionError#to_h
# File lib/graphql_rails/errors/validation_error.rb, line 18
def to_h
  super.merge('field' => field, 'short_message' => short_message)
end
type() click to toggle source
# File lib/graphql_rails/errors/validation_error.rb, line 14
def type
  'validation_error'
end