Exception: Graphiti::Errors::InvalidFilterValue

Inherits:
Base
  • Object
show all
Defined in:
lib/graphiti/errors.rb

Instance Method Summary collapse

Constructor Details

#initialize(resource, filter, value) ⇒ InvalidFilterValue

Returns a new instance of InvalidFilterValue.



137
138
139
140
141
# File 'lib/graphiti/errors.rb', line 137

def initialize(resource, filter, value)
  @resource = resource
  @filter = filter
  @value = value
end

Instance Method Details

#messageObject



143
144
145
146
147
148
149
150
151
152
# File 'lib/graphiti/errors.rb', line 143

def message
  allow = @filter.values[0][:allow]
  deny = @filter.values[0][:deny]
  msg = <<-MSG
    #{@resource.class.name}: tried to filter on #{@filter.keys[0].inspect}, but passed invalid value #{@value.inspect}.
  MSG
  msg << "\nAllowlist: #{allow.inspect}" if allow
  msg << "\nDenylist: #{deny.inspect}" if deny
  msg
end