Exception: GraphQL::Throttled

Inherits:
Error
  • Object
show all
Defined in:
lib/graphql/throttled.rb

Overview

An endpoint refusing a query for what it costs rather than for anything about the query itself. Worth telling apart: the same query is answered once the budget it is priced against has refilled.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, cost = {}) ⇒ Throttled

Returns a new instance of Throttled.

Parameters:

  • message (String)

    what the endpoint said, with the numbers it said it with.

  • cost (Hash) (defaults to: {})

    what it priced the query at, and the budget it priced it against.



8
9
10
11
# File 'lib/graphql/throttled.rb', line 8

def initialize(message, cost = {})
  super message
  @cost = cost
end

Instance Attribute Details

#costHash (readonly)

Returns those numbers, in the endpoint's own words.

Returns:

  • (Hash)

    those numbers, in the endpoint's own words.



14
15
16
# File 'lib/graphql/throttled.rb', line 14

def cost
  @cost
end