# CellError Class

# Constructors

# constructor

+ new CellError(type: ErrorType, message?: undefined | string, root?: FormulaVertex, originFunction?: undefined | string, argumentIndex?: undefined | number, propagated: boolean, originAddress?: SimpleCellAddress): CellError

Defined in src/Cell.ts:149 (opens new window)

Parameters:

Name Type Default
type ErrorType -
message? undefined | string -
root? FormulaVertex -
originFunction? undefined | string -
argumentIndex? undefined | number -
propagated boolean false
originAddress? SimpleCellAddress -

Returns: CellError

# Properties

# argumentIndex OptionalReadonly

argumentIndex? : undefined | number

Defined in src/Cell.ts:155 (opens new window)


# message OptionalReadonly

message? : undefined | string

Defined in src/Cell.ts:152 (opens new window)


# originAddress OptionalReadonly

originAddress? : SimpleCellAddress

Defined in src/Cell.ts:157 (opens new window)


# originFunction OptionalReadonly

originFunction? : undefined | string

Defined in src/Cell.ts:154 (opens new window)


# propagated Readonly

propagated: boolean

Defined in src/Cell.ts:156 (opens new window)


# root OptionalReadonly

root? : FormulaVertex

Defined in src/Cell.ts:153 (opens new window)


# type Readonly

type: ErrorType

Defined in src/Cell.ts:151 (opens new window)

# Methods

# asPropagated

asPropagated(): CellError

Defined in src/Cell.ts:203 (opens new window)

Marks this error as read from another cell rather than produced by the current evaluation.

This is what stops a cell from adopting an error it only read: attachRootVertex skips a propagated error, so the reported address stays the one where the error actually appeared.

Returns: CellError


# attachRootVertex

attachRootVertex(vertex: FormulaVertex): CellError

Defined in src/Cell.ts:236 (opens new window)

Parameters:

Name Type
vertex FormulaVertex

Returns: CellError


# withArgumentIndex

withArgumentIndex(index: number): CellError

Defined in src/Cell.ts:190 (opens new window)

Records which argument of the origin function was rejected. First occurrence wins, and a propagated error never acquires one: the reading function's own argument slot is not the offending argument.

Also a no-op once originFunction is set, even for a non-propagated error: a nested call's own error (e.g. SQRT(-1) inside =DATE(1,1,SQRT(-1))) stamps its origin before the outer call's coercion loop ever sees it, and that loop's own argument slot is not the one that actually produced the error — attaching an index here would pair someone else's origin with this call's argument position, which is incoherent.

Parameters:

Name Type Description
index number zero-based index of the offending argument

Returns: CellError


# withOrigin

withOrigin(functionName: string): CellError

Defined in src/Cell.ts:170 (opens new window)

Names the function or operator that produced this error.

First occurrence wins, so an outer function that merely received the error back does not claim it: =SUM(SQRT(-1)) keeps SQRT. A propagated error — one read out of another cell rather than produced here — can never acquire an origin it did not already have.

Parameters:

Name Type Description
functionName string the function or operator helper that produced the error

Returns: CellError


# withOriginAddress

withOriginAddress(address: SimpleCellAddress): CellError

Defined in src/Cell.ts:221 (opens new window)

Records the address an otherwise rootless error appeared at.

For vertices that hold a static error rather than computing one (a parse error, or an error value the user typed), there is no FormulaVertex to serve as a lazily-resolved root. This cannot go stale: CellError is immutable, so the stored value is never stamped — every read stamps a fresh copy with the address current at that moment, which is what keeps it correct across row and column changes.

Parameters:

Name Type Description
address SimpleCellAddress the address the error was read from

Returns: CellError


# parsingError Static

parsingError(detailedMessage?: undefined | string): CellError

Defined in src/Cell.ts:232 (opens new window)

Returns a CellError with a given message.

Parameters:

Name Type Description
detailedMessage? undefined | string message to be displayed

Returns: CellError