Exception: Parse::AutofetchTriggeredError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/parse/stack.rb

Overview

Error raised when autofetch would be triggered but Parse.autofetch_raise_on_missing_keys is true. This helps developers identify where they need to add additional keys to their queries.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass, object_id, field, is_pointer:) ⇒ AutofetchTriggeredError

Returns a new instance of AutofetchTriggeredError.



359
360
361
362
363
364
365
366
367
368
369
370
# File 'lib/parse/stack.rb', line 359

def initialize(klass, object_id, field, is_pointer:)
  @klass = klass
  @parse_object_id = object_id
  @field = field
  @is_pointer = is_pointer

  if is_pointer
    super("Autofetch triggered on #{klass}##{object_id} - pointer accessed field :#{field}. Add this field to your includes or fetch the object first.")
  else
    super("Autofetch triggered on #{klass}##{object_id} - field :#{field} was not included in partial fetch. Add :#{field} to your query keys.")
  end
end

Instance Attribute Details

#fieldObject (readonly)

Returns the value of attribute field.



357
358
359
# File 'lib/parse/stack.rb', line 357

def field
  @field
end

#is_pointerObject (readonly)

Returns the value of attribute is_pointer.



357
358
359
# File 'lib/parse/stack.rb', line 357

def is_pointer
  @is_pointer
end

#klassObject (readonly)

Returns the value of attribute klass.



357
358
359
# File 'lib/parse/stack.rb', line 357

def klass
  @klass
end

#parse_object_idObject (readonly)

Returns the value of attribute parse_object_id.



357
358
359
# File 'lib/parse/stack.rb', line 357

def parse_object_id
  @parse_object_id
end