Skip to content

FormulaError

new FormulaError(
name,
code,
detail,
origin): FormulaError;

string

the error name, such as ‘#VALUE!’ or ‘#NAME?‘

number

integer error code

string | null

Reference | null

FormulaError

readonly code: number;

readonly detail: string | null = null;

readonly name: string;

readonly origin: Reference | null = null;

readonly static detailedErrors: Map<string, FormulaError>;
get detailedMessage(): string;

A string representation of this error including its detail message, if any, in parentheses.

string


get detailedMessageWithOrigin(): string;

A string representation of this error including its detail message and/or origin, if any. This is intended for development and debugging rather than for end-user display, and its exact format may change.

string

detailed(detail): FormulaError;

Get an instance of this error type with the given detail, available as the .detail property.

Intended usage:

  • Instead of using ERROR_FOO, use ERROR_FOO.detailed(detailText) to include detail specific to this error
  • When displaying an error, expose .detail if and as appropriate (e.g. only in edit mode?)
  • The detail text should be short and oriented towards helping authors understand how their model goes wrong, e.g. for ERROR_NAME the detail text might be the function name or defined name that wasn’t recognized.
  • Apiary internals should not be exposed (e.g. exception messages, except where known to be end-user-friendly)

Error instances created this way are memoized, so that only one error instance with a given code, name and detail will be created.

string

some textual detail about the error, e.g. the unrecognized function name for #NAME?

FormulaError


equals(other): boolean;

unknown

boolean


toString(): string;

string


valueOf(): string;

string


withOrigin(origin): FormulaError;

Make a new FormulaError instance like this one but with the given origin.

a fully-prefixed reference to the cell in which this error originated, or null to set no origin.

Reference | null

FormulaError

A new FormulaError instance with the given origin