lib/graphql/execution/errors.rb
def with_error_handling(ctx)
        yield
      rescue StandardError => err
        rescues = @schema.rescues
        _err_class, handler = rescues.find { |err_class, handler| err.is_a?(err_class) }
        if handler
          runtime_info = ctx.namespace(:interpreter) || {}
          obj = runtime_info[:current_object]
          args = runtime_info[:current_arguments]
          field = runtime_info[:current_field]
          if obj.is_a?(GraphQL::Schema::Object)
            obj = obj.object
          end
          handler.call(err, obj, args, ctx, field)
        else
          raise err
        end
      end
# Call the given block with the schema's configured error handlers.
#
# If the block returns a lazy value, it's not wrapped with error handling. That area will have to be wrapped itself.
#
# @param ctx [GraphQL::Query::Context]
# @return [Object] Either the result of the given block, or some object to replace the result, in case of error handling.
Call the given block with the schema's configured error handlers.
If the block returns a lazy value, it's not wrapped with error handling. That area will have to be wrapped itself.
Call the given block with the schema ' s configured error handlers . If the block returns a lazy value it ' s not wrapped with error handling . That area will have to be wrapped itself .
def with_error_handling(ctx)
        yield
      rescue StandardError => err
        rescues = @schema.rescues
        _err_class, handler = rescues.find { |err_class, handler| err.is_a?(err_class) }
        if handler
          runtime_info = ctx.namespace(:interpreter) || {}
          obj = runtime_info[:current_object]
          args = runtime_info[:current_arguments]
          field = runtime_info[:current_field]
          if obj.is_a?(GraphQL::Schema::Object)
            obj = obj.object
          end
          handler.call(err, obj, args, ctx, field)
        else
          raise err
        end
      end
def with_error_handling ( ctx ) yield rescue StandardError => err rescues = @schema . rescues _err_class , handler = rescues . find { | err_class , handler | err . is_a? ( err_class ) } if handler runtime_info = ctx . namespace ( :interpreter ) || { } obj = runtime_info [ :current_object ] args = runtime_info [ :current_arguments ] field = runtime_info [ :current_field ] if obj . is_a? ( GraphQL :: Schema :: Object ) obj = obj . object end handler . call ( err , obj , args , ctx , field ) else raise err end end
Call the given block with the schema's configured error handlers.
Call the given block with the schema ' s configured error handlers .
Either the result of the given block, or some object to replace the result, in case of error handling.
Either the result of the given block or some object to replace the result in case of error handling .
Object
ctx
None