Exception: GraphQL::IntegerEncodingError
- Inherits:
-
RuntimeTypeError
- Object
- StandardError
- Error
- 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:
ID
for database primary keys or other identifiersGraphQL::Types::BigInt
for really big integer values
Instance Attribute Summary collapse
-
#field ⇒ GraphQL::Schema::Field
readonly
The field that returned a too-big integer.
-
#integer_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:) ⇒ IntegerEncodingError
constructor
A new instance of IntegerEncodingError.
Constructor Details
#initialize(value, context:) ⇒ IntegerEncodingError
Returns a new instance of IntegerEncodingError.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/graphql/integer_encoding_error.rb', line 21 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 ⇒ GraphQL::Schema::Field (readonly)
Returns The field that returned a too-big integer.
16 17 18 |
# File 'lib/graphql/integer_encoding_error.rb', line 16 def field @field end |
#integer_value ⇒ Object (readonly)
The value which couldn't be encoded
13 14 15 |
# File 'lib/graphql/integer_encoding_error.rb', line 13 def integer_value @integer_value end |
#path ⇒ Array<String, Integer> (readonly)
Returns Where the field appeared in the GraphQL response.
19 20 21 |
# File 'lib/graphql/integer_encoding_error.rb', line 19 def path @path end |