Class: ObjectPatch::FailedTestException

Inherits:
BaseException
  • Object
show all
Defined in:
lib/object_patch/exceptions.rb

Overview

An exception that will get raised when a test operation fails after being applied to a document.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, value) ⇒ void

Formats the exception message with the relevant information before actually raising the error.

Parameters:

  • path (String)
  • value (Object)


45
46
47
48
# File 'lib/object_patch/exceptions.rb', line 45

def initialize(path, value)
  super("Expected #{value} at #{path}")
  @path, @value = path, value
end

Instance Attribute Details

#pathString

A JSON pointer string representing the location to be checked.

Returns:

  • (String)

    the current value of path



36
37
38
# File 'lib/object_patch/exceptions.rb', line 36

def path
  @path
end

#valueObject

The value that failed the comparison check.

Returns:

  • (Object)

    the current value of value



36
37
38
# File 'lib/object_patch/exceptions.rb', line 36

def value
  @value
end