Exception: Graphiti::Errors::RecordNotFound

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

Instance Method Summary collapse

Constructor Details

#initialize(resource = nil, id = nil, path = nil) ⇒ RecordNotFound

Returns a new instance of RecordNotFound.



769
770
771
772
773
# File 'lib/graphiti/errors.rb', line 769

def initialize(resource = nil, id = nil, path = nil)
  @resource = resource
  @id = id
  @path = path
end

Instance Method Details

#messageObject



775
776
777
778
779
780
781
782
783
# File 'lib/graphiti/errors.rb', line 775

def message
  if !@resource.nil? && !@id.nil?
    "The referenced resource '#{@resource}' with id '#{@id}' could not be found.".tap do |msg|
      msg << " Referenced at '#{@path}'" unless @path.nil?
    end
  else
    "Specified Record Not Found"
  end
end