Sha256: a4d5213cc5a636762ee076f64957e1ed87cf226b7fc287e5ff2df90b3b06f96f

Contents?: true

Size: 478 Bytes

Versions: 2

Compression:

Stored size: 478 Bytes

Contents

# frozen_string_literal: true

module GraphqlRails
  require 'graphql'

  # base class which is returned in case something bad happens. Contains all error rendering structure
  class ExecutionError < GraphQL::ExecutionError
    def to_h
      super.merge(extra_graphql_data)
    end

    def extra_graphql_data
      {}.tap do |data|
        data['type'] = type if respond_to?(:type) && type
        data['code'] = type if respond_to?(:code) && code
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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