Exception: GraphQL::StringEncodingError

Inherits:
RuntimeTypeError show all
Defined in:
lib/graphql/string_encoding_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(str, context:) ⇒ StringEncodingError

Returns a new instance of StringEncodingError.


5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/graphql/string_encoding_error.rb', line 5

def initialize(str, context:)
  @string = str
  @field = context[:current_field]
  @path = context[:current_path]
  message = "String #{str.inspect} was encoded as #{str.encoding}".dup
  if @path
    message << " @ #{@path.join(".")}"
  end
  if @field
    message << " (#{@field.path})"
  end
  message << ". GraphQL requires an encoding compatible with UTF-8."
  super(message)
end

Instance Attribute Details

#fieldObject (readonly)

Returns the value of attribute field.


4
5
6
# File 'lib/graphql/string_encoding_error.rb', line 4

def field
  @field
end

#pathObject (readonly)

Returns the value of attribute path.


4
5
6
# File 'lib/graphql/string_encoding_error.rb', line 4

def path
  @path
end

#stringObject (readonly)

Returns the value of attribute string.


4
5
6
# File 'lib/graphql/string_encoding_error.rb', line 4

def string
  @string
end