Sha256: 4d58dc70200de9b01fd5e48ba03f8bd0a39deabb9204dbb6d983680ad90546b3

Contents?: true

Size: 546 Bytes

Versions: 2

Compression:

Stored size: 546 Bytes

Contents

# frozen_string_literal: true

module GraphqlRails
  # base class which is returned in case something bad happens. Contains all error rendering structure
  class CustomExecutionError < ExecutionError
    attr_reader :extra_graphql_data

    def self.accepts?(error)
      error.is_a?(Hash) &&
        (error.key?(:message) || error.key?('message'))
    end

    def initialize(message, extra_graphql_data = {})
      super(message)
      @extra_graphql_data = extra_graphql_data.stringify_keys
    end

    def to_h
      super
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
graphql_rails-3.0.0 lib/graphql_rails/errors/custom_execution_error.rb
graphql_rails-2.4.0 lib/graphql_rails/errors/custom_execution_error.rb