Class: GraphqlRails::ValidationError
- Inherits:
-
ExecutionError
- Object
- GraphQL::ExecutionError
- ExecutionError
- GraphqlRails::ValidationError
- Defined in:
- lib/graphql_rails/errors/validation_error.rb
Overview
GraphQL error that is raised when invalid data is given
Constant Summary collapse
- BASE_FIELD_NAME =
'base'
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
Returns the value of attribute field.
-
#short_message ⇒ Object
readonly
Returns the value of attribute short_message.
Instance Method Summary collapse
-
#initialize(short_message, field) ⇒ ValidationError
constructor
A new instance of ValidationError.
- #to_h ⇒ Object
- #type ⇒ Object
Methods inherited from ExecutionError
Constructor Details
#initialize(short_message, field) ⇒ ValidationError
Returns a new instance of ValidationError.
10 11 12 13 14 |
# File 'lib/graphql_rails/errors/validation_error.rb', line 10 def initialize(, field) super([humanized_field(field), ].compact.join(' ')) @short_message = @field = field end |
Instance Attribute Details
#field ⇒ Object (readonly)
Returns the value of attribute field.
8 9 10 |
# File 'lib/graphql_rails/errors/validation_error.rb', line 8 def field @field end |
#short_message ⇒ Object (readonly)
Returns the value of attribute short_message.
8 9 10 |
# File 'lib/graphql_rails/errors/validation_error.rb', line 8 def @short_message end |
Instance Method Details
#to_h ⇒ Object
20 21 22 |
# File 'lib/graphql_rails/errors/validation_error.rb', line 20 def to_h super.merge('field' => field, 'short_message' => ) end |
#type ⇒ Object
16 17 18 |
# File 'lib/graphql_rails/errors/validation_error.rb', line 16 def type 'validation_error' end |