StateVarError Reference

Table of Contents


Introduction

The StateVarError object is used as a state variable error value. It extends the JavaScript Error class. When a StateVarError instance is used in a computation, it resolves to the value of this.cause.errorValue if it exists or NaN if cause is an object without an errorValue. An instance must be created with an object cause (for example {cause:{errorValue: '-'}}): without one, valueOf() throws a TypeError. When used as a String, it resolves to this.message.

Predefined error values

There are several predefined instances of StateVarError. See Predefined StateVarError instances

Constructor

Syntax

new StateVarError()
new StateVarError(message)
new StateVarError(message, options)
new StateVarError(message, fileName)
new StateVarError(message, fileName, lineNumber)

The StateVarError constructor takes the same parameters as the JavaScript Error constructor.


Instance methods

valueOf()

Syntax

valueOf()

Returns the value of this.cause.errorValue if it exists or NaN if cause has no errorValue. Throws a TypeError if the instance has no cause object.


toString()

Syntax

toString()

Returns the value of this.message.


Predefined StateVarError instances

INVALID_NONE


INVALID_VALUE


INVALID_POH