Class: GraphQL::IntegerEncodingError
- Inherits:
-
RuntimeTypeError
- Object
- RuntimeTypeError
- GraphQL::IntegerEncodingError
- Defined in:
- lib/graphql/integer_encoding_error.rb
Overview
This error is raised when Types::Int is asked to return a value outside of 32-bit integer range.
For values outside that range, consider:
IDfor database primary keys or other identifiersGraphQL::Types::BigIntfor really big integer values
See GraphQL::Types::Int which raises this error
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
Returns.
-
#integer_value ⇒ Object
readonly
The value which couldn't be encoded.
-
#path ⇒ Object
readonly
Returns.
Instance Method Summary collapse
-
#initialize(value, context:) ⇒ IntegerEncodingError
constructor
A new instance of IntegerEncodingError.
Constructor Details
#initialize(value, context:) ⇒ IntegerEncodingError
Returns a new instance of IntegerEncodingError.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/graphql/integer_encoding_error.rb', line 27 def initialize(value, context:) @integer_value = value @field = context[:current_field] @path = context[:current_path] = "Integer out of bounds: #{value}".dup if @path << " @ #{@path.join(".")}" end if @field << " (#{@field.path})" end << ". Consider using ID or GraphQL::Types::BigInt instead." super() end |
Instance Attribute Details
#field ⇒ Object (readonly)
Returns
GraphQL::Schema::Field— The field that returned a too-big integer
20 21 22 |
# File 'lib/graphql/integer_encoding_error.rb', line 20 def field @field end |
#integer_value ⇒ Object (readonly)
The value which couldn't be encoded
15 16 17 |
# File 'lib/graphql/integer_encoding_error.rb', line 15 def integer_value @integer_value end |
#path ⇒ Object (readonly)
Returns
Array<String, Integer>— Where the field appeared in the GraphQL response
25 26 27 |
# File 'lib/graphql/integer_encoding_error.rb', line 25 def path @path end |