Sha256: 0c4dc1fe46192ee45dda53a5e350dfe355eb6ac9a3d6a9830d83c04a6fb96ced

Contents?: true

Size: 659 Bytes

Versions: 27

Compression:

Stored size: 659 Bytes

Contents

module GraphQL
  # If a field's resolve function returns a {ExecutionError},
  # the error will be inserted into the response's `"errors"` key
  # and the field will resolve to `nil`.
  class ExecutionError < GraphQL::Error
    # @return [GraphQL::Language::Nodes::Field] the field where the error occured
    attr_accessor :ast_node

    # @return [Hash] An entry for the response's "errors" key
    def to_h
      hash = {
        "message" => message,
      }
      if ast_node
        hash["locations"] = [
          {
            "line" => ast_node.line,
            "column" => ast_node.col,
          }
        ]
      end
      hash
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
graphql-0.18.13 lib/graphql/execution_error.rb
graphql-0.18.12 lib/graphql/execution_error.rb
graphql-0.18.11 lib/graphql/execution_error.rb
graphql-0.18.10 lib/graphql/execution_error.rb
graphql-0.18.9 lib/graphql/execution_error.rb
graphql-0.18.8 lib/graphql/execution_error.rb
graphql-0.18.7 lib/graphql/execution_error.rb
graphql-0.18.6 lib/graphql/execution_error.rb
graphql-0.18.5 lib/graphql/execution_error.rb
graphql-0.18.4 lib/graphql/execution_error.rb
graphql-0.18.3 lib/graphql/execution_error.rb
graphql-0.18.2 lib/graphql/execution_error.rb
graphql-0.18.1 lib/graphql/execution_error.rb
graphql-0.18.0 lib/graphql/execution_error.rb
graphql-0.17.2 lib/graphql/execution_error.rb
graphql-0.17.1 lib/graphql/execution_error.rb
graphql-0.17.0 lib/graphql/execution_error.rb
graphql-0.16.1 lib/graphql/execution_error.rb
graphql-0.16.0 lib/graphql/execution_error.rb
graphql-0.15.3 lib/graphql/execution_error.rb