$k. Cause

new Cause(qualityopt, causePropertiesopt)

Creates a new cause

Parameters:
NameTypeAttributesDescription
qualitynumber<optional>

Quality of the cause

causePropertiesobject<optional>

Properties of the cause

Throws:

If the quality is not between 0 and 1

Provides additional details about a hit returned by a query

Type
$k.exception.InvalidValue

Methods

properties()

Returns all properties (restricted to those that can be converted to objects)

Since
  • 5.3.0

property(name)

Returns the value of the named property, or undefined if the property does not exist

Parameters:
NameTypeDescription
namestring
Throws:

quality() → {number}

Returns the quality of the cause, a number between 0 (worst quality) and 1 (best quality)

Returns:
Type: 
number

setProperties(properties)

Set the properties of the cause

Parameters:
NameTypeDescription
propertiesobject
Throws:

If the value is not a valid property value

Type
$k.exception.InvalidValue

setProperty(name, value)

Set the value of the named property

Parameters:
NameTypeDescription
namestring
value
Throws:

setQuality(quality)

Set the quality, a number between 0 and 1

Parameters:
NameTypeDescription
qualitynumber
Throws:

If the quality is not between 0 and 1

Type
$k.exception.InvalidValue

setType(type)

Set the type

Parameters:
NameTypeDescription
typestring
Throws:

If this is a system-defined cause

Type
RangeError

type() → {string}

Returns the type of the cause, e.g. 'semantic'

Returns:
Type: 
string