# CellError

## Constructors

### constructor 

\+ **new CellError**(`type`: [ErrorType](hyperformulans.md#static-errortype), `message?`: undefined | string, `root?`: FormulaVertex, `originFunction?`: undefined | string, `argumentIndex?`: undefined | number, `propagated`: boolean, `originAddress?`: [SimpleCellAddress](../interfaces/simplecelladdress.md), `originAddressVersion?`: undefined | number): *[CellError](cellerror.md)*

*Defined in [src/Cell.ts:149](https://github.com/handsontable/hyperformula/blob/624a8e4/src/Cell.ts#L149)*

**Parameters:**

Name | Type | Default |
------ | ------ | ------ |
`type` | [ErrorType](hyperformulans.md#static-errortype) | - |
`message?` | undefined &#124; string | - |
`root?` | FormulaVertex | - |
`originFunction?` | undefined &#124; string | - |
`argumentIndex?` | undefined &#124; number | - |
`propagated` | boolean | false |
`originAddress?` | [SimpleCellAddress](../interfaces/simplecelladdress.md) | - |
`originAddressVersion?` | undefined &#124; number | - |

**Returns:** *[CellError](cellerror.md)*

## Properties

### argumentIndex

• **argumentIndex**? : *undefined | number*

*Defined in [src/Cell.ts:155](https://github.com/handsontable/hyperformula/blob/624a8e4/src/Cell.ts#L155)*

___

### message

• **message**? : *undefined | string*

*Defined in [src/Cell.ts:152](https://github.com/handsontable/hyperformula/blob/624a8e4/src/Cell.ts#L152)*

___

### originAddress

• **originAddress**? : *[SimpleCellAddress](../interfaces/simplecelladdress.md)*

*Defined in [src/Cell.ts:157](https://github.com/handsontable/hyperformula/blob/624a8e4/src/Cell.ts#L157)*

___

### originAddressVersion

• **originAddressVersion**? : *undefined | number*

*Defined in [src/Cell.ts:158](https://github.com/handsontable/hyperformula/blob/624a8e4/src/Cell.ts#L158)*

___

### originFunction

• **originFunction**? : *undefined | string*

*Defined in [src/Cell.ts:154](https://github.com/handsontable/hyperformula/blob/624a8e4/src/Cell.ts#L154)*

___

### propagated

• **propagated**: *boolean*

*Defined in [src/Cell.ts:156](https://github.com/handsontable/hyperformula/blob/624a8e4/src/Cell.ts#L156)*

___

### root

• **root**? : *FormulaVertex*

*Defined in [src/Cell.ts:153](https://github.com/handsontable/hyperformula/blob/624a8e4/src/Cell.ts#L153)*

___

### type

• **type**: *[ErrorType](hyperformulans.md#static-errortype)*

*Defined in [src/Cell.ts:151](https://github.com/handsontable/hyperformula/blob/624a8e4/src/Cell.ts#L151)*

## Methods

### asPropagated 

▸ **asPropagated**(): *[CellError](cellerror.md)*

*Defined in [src/Cell.ts:204](https://github.com/handsontable/hyperformula/blob/624a8e4/src/Cell.ts#L204)*

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](cellerror.md#attachrootvertex) skips
a propagated error, so the reported address stays the one where the error actually appeared.

**Returns:** *[CellError](cellerror.md)*

___

### attachRootVertex 

▸ **attachRootVertex**(`vertex`: FormulaVertex): *[CellError](cellerror.md)*

*Defined in [src/Cell.ts:241](https://github.com/handsontable/hyperformula/blob/624a8e4/src/Cell.ts#L241)*

**Parameters:**

Name | Type |
------ | ------ |
`vertex` | FormulaVertex |

**Returns:** *[CellError](cellerror.md)*

___

### withArgumentIndex 

▸ **withArgumentIndex**(`index`: number): *[CellError](cellerror.md)*

*Defined in [src/Cell.ts:191](https://github.com/handsontable/hyperformula/blob/624a8e4/src/Cell.ts#L191)*

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](cellerror.md)*

___

### withOrigin 

▸ **withOrigin**(`functionName`: string): *[CellError](cellerror.md)*

*Defined in [src/Cell.ts:171](https://github.com/handsontable/hyperformula/blob/624a8e4/src/Cell.ts#L171)*

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](cellerror.md)*

___

### withOriginAddress 

▸ **withOriginAddress**(`address`: [SimpleCellAddress](../interfaces/simplecelladdress.md), `version`: number): *[CellError](cellerror.md)*

*Defined in [src/Cell.ts:226](https://github.com/handsontable/hyperformula/blob/624a8e4/src/Cell.ts#L226)*

Records the address an otherwise rootless error appeared at, and the moment it was recorded.

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`, so
the address has to be recorded on the value itself. A recorded address is a snapshot and does
go stale: the cell that read it caches this instance, and a later row or column change that
merely shifts that cell does not recompute it. The `version` is what makes the snapshot
repairable — it names the point in `LazilyTransformingAstService`'s history the address was
true at, so `Exporter` can replay the intervening transformations over it and report where the
origin sits now. See [LazilyTransformingAstService.applyTransformationsToAddress](lazilytransformingastservice.md#applytransformationstoaddress).

**Parameters:**

Name | Type | Description |
------ | ------ | ------ |
`address` | [SimpleCellAddress](../interfaces/simplecelladdress.md) | the address the error was read from |
`version` | number | the transformation version that address was current at  |

**Returns:** *[CellError](cellerror.md)*

___

### parsingError

▸ **parsingError**(`detailedMessage?`: undefined | string): *[CellError](cellerror.md)*

*Defined in [src/Cell.ts:237](https://github.com/handsontable/hyperformula/blob/624a8e4/src/Cell.ts#L237)*

Returns a CellError with a given message.

**Parameters:**

Name | Type | Description |
------ | ------ | ------ |
`detailedMessage?` | undefined &#124; string | message to be displayed  |

**Returns:** *[CellError](cellerror.md)*