ModelError
Extends
Section titled “Extends”Error
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ModelError( message, level, cells?, type?, origException?): ModelError;Parameters
Section titled “Parameters”message
Section titled “message”string
Level = WARNING
cells?
Section titled “cells?”ConvertibleToVertexIDs = null
indications of cell(s) or defined name(s) associated with the error
string = 'unknown'
error type identifier
origException?
Section titled “origException?”original exception, included for troubleshooting errors whose reason is unknown
Error | null
Returns
Section titled “Returns”ModelError
Overrides
Section titled “Overrides”Error.constructorProperties
Section titled “Properties”cause?
Section titled “cause?”optional cause: unknown;Inherited from
Section titled “Inherited from”Error.causelevel: Level;message
Section titled “message”message: string;Inherited from
Section titled “Inherited from”Error.messagename: string;Inherited from
Section titled “Inherited from”Error.nameorigException
Section titled “origException”origException: Error & object | null = null;stack?
Section titled “stack?”optional stack: string;Inherited from
Section titled “Inherited from”Error.stacktype: string;vertexIds
Section titled “vertexIds”vertexIds: VertexIdSet<CellVertexId | NameVertexId>;workbook
Section titled “workbook”workbook: Workbook | null = null;readonly static ERROR: 3;readonly static NONE: 0;NOTICE
Section titled “NOTICE”readonly static NOTICE: 1;stackTraceLimit
Section titled “stackTraceLimit”static stackTraceLimit: number;The Error.stackTraceLimit property specifies the number of stack frames
collected by a stack trace (whether generated by new Error().stack or
Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes
will affect any stack trace captured after the value has been changed.
If set to a non-number value, or set to a negative number, stack traces will not capture any frames.
Inherited from
Section titled “Inherited from”Error.stackTraceLimitUNKNOWN
Section titled “UNKNOWN”readonly static UNKNOWN: -1;WARNING
Section titled “WARNING”readonly static WARNING: 2;Accessors
Section titled “Accessors”references
Section titled “references”Get Signature
Section titled “Get Signature”get references(): Set<string>;Returns
Section titled “Returns”Set<string>
set of cell IDs (e.g. Sheet1!A1), defined names, and column names for structured sheets
Methods
Section titled “Methods”toJSON()
Section titled “toJSON()”toJSON(): object;Produce a representation of this error for JSON serialization.
Adds the non-enumerable properties message and origException (the latter only if set),
and makes cells an array.
Despite the name, this does not return a JSON string, it returns an object to stringify instead of this one, see
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#tojson_behavior
Returns
Section titled “Returns”object
an object that will JSON.stringify more usefully than this instance.
level: number;message
Section titled “message”message: string;origException?
Section titled “origException?”optional origException: object;origException.message
Section titled “origException.message”message: string;origException.stack
Section titled “origException.stack”stack: string | undefined;type: string;vertexIds
Section titled “vertexIds”vertexIds: string[];toString()
Section titled “toString()”toString(): string;Returns a string representation of an object.
Returns
Section titled “Returns”string
valueOf()
Section titled “valueOf()”valueOf(): string;Returns the primitive value of the specified object.
Returns
Section titled “Returns”string
captureStackTrace()
Section titled “captureStackTrace()”static captureStackTrace(targetObject, constructorOpt?): void;Creates a .stack property on targetObject, which when accessed returns
a string representing the location in the code at which
Error.captureStackTrace() was called.
const myObject = {};Error.captureStackTrace(myObject);myObject.stack; // Similar to `new Error().stack`The first line of the trace will be prefixed with
${myObject.name}: ${myObject.message}.
The optional constructorOpt argument accepts a function. If given, all frames
above constructorOpt, including constructorOpt, will be omitted from the
generated stack trace.
The constructorOpt argument is useful for hiding implementation
details of error generation from the user. For instance:
function a() { b();}
function b() { c();}
function c() { // Create an error without stack trace to avoid calculating the stack trace twice. const { stackTraceLimit } = Error; Error.stackTraceLimit = 0; const error = new Error(); Error.stackTraceLimit = stackTraceLimit;
// Capture the stack trace above function b Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace throw error;}
a();Parameters
Section titled “Parameters”targetObject
Section titled “targetObject”object
constructorOpt?
Section titled “constructorOpt?”Function
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Error.captureStackTracefromCircularDependencyWith()
Section titled “fromCircularDependencyWith()”static fromCircularDependencyWith(vertexIds): ModelError;Create a circular dependency error involving the given cells.
Parameters
Section titled “Parameters”vertexIds
Section titled “vertexIds”ConvertibleToVertexIDs
vertex IDs of cells (defined names or sheet cells) known to be involved in a dependency cycle
Returns
Section titled “Returns”ModelError
fromInvalidCellValueAt()
Section titled “fromInvalidCellValueAt()”static fromInvalidCellValueAt(vertexIds): ModelError;Create an error about invalid cell values in workbook input in the given cells.
Parameters
Section titled “Parameters”vertexIds
Section titled “vertexIds”ConvertibleToVertexIDs
vertex IDs of cells (defined names or sheet cells) in which invalid cell values were found and replaced with #VALUE!
Returns
Section titled “Returns”ModelError
fromUnsupported()
Section titled “fromUnsupported()”static fromUnsupported( what, neverSupport, cell, isOrAre?, type?): ModelError;Create an error representing something unsupported (a spreadsheet function or other functionality) in a formula
Parameters
Section titled “Parameters”string
the function name or a concise description of the functionality
neverSupport
Section titled “neverSupport”boolean
true if we intend never to support the thing, false if we think we maybe will
the sheet-prefixed cell address or defined name whose formula contains the unsupported thing
CellVertexId | NameVertexId | CellItem
isOrAre?
Section titled “isOrAre?”whichever verb form makes sense after what
"is" | "are"
optional override of the ModelError type; the default type is fn-unsup if
neverSupport is true, else fn
string | null
Returns
Section titled “Returns”ModelError
isError()
Section titled “isError()”static isError(error): error is Error;Indicates whether the argument provided is a built-in Error instance or not.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”error is Error
Inherited from
Section titled “Inherited from”Error.isErrorprepareStackTrace()
Section titled “prepareStackTrace()”static prepareStackTrace(err, stackTraces): any;Parameters
Section titled “Parameters”Error
stackTraces
Section titled “stackTraces”CallSite[]
Returns
Section titled “Returns”any
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Inherited from
Section titled “Inherited from”Error.prepareStackTrace