该页面暂无翻译,已显示英文版本。
TaffyError
Error class thrown when a Taffy operation fails, containing a human-readable error message.
This class wraps the native [taffy::TaffyError] type and exposes it to JavaScript
with a readable error message. It is thrown as a JavaScript exception on failure.
Example
try { const tree = new TaffyTree(); const node = tree.newLeaf(new Style()); tree.remove(node); } catch (e) { if (e instanceof TaffyError) { console.error(e.message); } }
Remarks
The underlying Taffy errors include:
InvalidInputNode: Node ID doesn't exist in the treeInvalidParentNode: Specified parent node doesn't existChildIndexOutOfBounds: Child index exceeds available children
Properties
| Property | Modifier | Type | Description |
|---|---|---|---|
message | readonly | string | Gets the human-readable error message Remarks Examples: - "Node with id 1234 is not present in the Taffy tree" - "Index 5 is out of bounds for node with 3 children" |
Methods
[dispose]()
dispose: void;
Returns
void
free()
free(): void;
Returns
void