Skip to content

Commit d6d494d

Browse files
committed
graphql: Add types for GraphQL::ExecutionError#initialize
Add type definitions for `GraphQL::ExecutionError#initialize` method. References: - https://graphql-ruby.org/api-doc/1.12.0/GraphQL/ExecutionError.html#initialize-instance_method - https://github.com/rmosolgo/graphql-ruby/blob/v1.12.0/lib/graphql/execution_error.rb
1 parent ed61b16 commit d6d494d

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

gems/graphql/1.12/_test/test.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ def ping = context[:ping]
5555
field :article, String, null: false do
5656
argument :id, ID, required: true
5757
end
58+
59+
field :error_field, String, null: false
60+
def error_field
61+
raise GraphQL::ExecutionError.new("Test error message", ast_node: nil, options: { "custom" => "option" }, extensions: { "code" => "TEST_ERROR" })
62+
end
5863
end
5964
end
6065

gems/graphql/1.12/_test/test.rbs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ module Types
5252
include GraphQL::Types::Relay::HasNodeField
5353

5454
def ping: -> untyped
55+
56+
def error_field: -> untyped
5557
end
5658
end
5759

gems/graphql/1.12/graphql.rbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ module GraphQL
191191
class Error < StandardError
192192
end
193193
class ExecutionError < Error
194+
def initialize: (String message, ?ast_node: untyped, ?options: Hash[untyped, untyped]?, ?extensions: Hash[untyped, untyped]?) -> void
194195
def to_h: () -> Hash[String, untyped]
195196
end
196197
class RequiredImplementationMissingError < Error

0 commit comments

Comments
 (0)