Class: GraphQL::FloatEncodingError
- Inherits:
-
RuntimeTypeError
- Object
- RuntimeTypeError
- GraphQL::FloatEncodingError
- Defined in:
- lib/graphql/float_encoding_error.rb
Overview
This error is raised when Types::Float is asked to return a non-finite value.
Instance Attribute Summary collapse
-
#field ⇒ GraphQL::Schema::Field
readonly
The field that returned a non-finite float.
-
#float_value ⇒ Object
readonly
The value which couldn't be encoded.
-
#path ⇒ Array<String, Integer>
readonly
Where the field appeared in the GraphQL response.
Instance Method Summary collapse
-
#initialize(value, context:) ⇒ FloatEncodingError
constructor
A new instance of FloatEncodingError.
Constructor Details
#initialize(value, context:) ⇒ FloatEncodingError
Returns a new instance of FloatEncodingError.
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/graphql/float_encoding_error.rb', line 14 def initialize(value, context:) @float_value = value @field = context[:current_field] @path = context[:current_path] = "Float is not finite: #{value.inspect}".dup if @path << " @ #{@path.join(".")}" end if @field << " (#{@field.path})" end super("#{}.") end |
Instance Attribute Details
#field ⇒ GraphQL::Schema::Field (readonly)
Returns The field that returned a non-finite float.
9 10 11 |
# File 'lib/graphql/float_encoding_error.rb', line 9 def field @field end |
#float_value ⇒ Object (readonly)
The value which couldn't be encoded
6 7 8 |
# File 'lib/graphql/float_encoding_error.rb', line 6 def float_value @float_value end |
#path ⇒ Array<String, Integer> (readonly)
Returns Where the field appeared in the GraphQL response.
12 13 14 |
# File 'lib/graphql/float_encoding_error.rb', line 12 def path @path end |