FormulaError
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new FormulaError( name, code, detail, origin): FormulaError;Parameters
Section titled “Parameters”string
the error name, such as ‘#VALUE!’ or ‘#NAME?‘
number
integer error code
detail
Section titled “detail”string | null
origin
Section titled “origin”Reference | null
Returns
Section titled “Returns”FormulaError
Properties
Section titled “Properties”readonly code: number;detail
Section titled “detail”readonly detail: string | null = null;readonly name: string;origin
Section titled “origin”readonly origin: Reference | null = null;detailedErrors
Section titled “detailedErrors”readonly static detailedErrors: Map<string, FormulaError>;Accessors
Section titled “Accessors”detailedMessage
Section titled “detailedMessage”Get Signature
Section titled “Get Signature”get detailedMessage(): string;A string representation of this error including its detail message, if any, in parentheses.
Returns
Section titled “Returns”string
detailedMessageWithOrigin
Section titled “detailedMessageWithOrigin”Get Signature
Section titled “Get Signature”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.
Returns
Section titled “Returns”string
Methods
Section titled “Methods”detailed()
Section titled “detailed()”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
.detailif 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.
Parameters
Section titled “Parameters”detail
Section titled “detail”string
some textual detail about the error, e.g. the unrecognized function name for #NAME?
Returns
Section titled “Returns”FormulaError
equals()
Section titled “equals()”equals(other): boolean;Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”boolean
toString()
Section titled “toString()”toString(): string;Returns
Section titled “Returns”string
valueOf()
Section titled “valueOf()”valueOf(): string;Returns
Section titled “Returns”string
withOrigin()
Section titled “withOrigin()”withOrigin(origin): FormulaError;Make a new FormulaError instance like this one but with the given origin.
Parameters
Section titled “Parameters”origin
Section titled “origin”a fully-prefixed reference to the cell in which this error originated, or null to set no origin.
Reference | null
Returns
Section titled “Returns”FormulaError
A new FormulaError instance with the given origin