Exception: Graphiti::Errors::InvalidFilterValue
- Defined in:
- lib/graphiti/errors.rb
Instance Method Summary collapse
-
#initialize(resource, filter, value) ⇒ InvalidFilterValue
constructor
A new instance of InvalidFilterValue.
- #message ⇒ Object
Constructor Details
#initialize(resource, filter, value) ⇒ InvalidFilterValue
Returns a new instance of InvalidFilterValue.
162 163 164 165 166 |
# File 'lib/graphiti/errors.rb', line 162 def initialize(resource, filter, value) @resource = resource @filter = filter @value = value end |
Instance Method Details
#message ⇒ Object
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/graphiti/errors.rb', line 168 def allow = @filter.values[0][:allow] deny = @filter.values[0][:deny] value_string = if @value == "(empty)" "empty value" else "value #{@value.inspect}" end msg = <<~MSG #{@resource.class.name}: tried to filter on #{@filter.keys[0].inspect}, but passed invalid #{value_string}. MSG msg << "\nAllowlist: #{allow.inspect}" if allow msg << "\nDenylist: #{deny.inspect}" if deny msg end |