MCPcopy
hub / github.com/tldraw/tldraw / createErrorAnnotations

Method createErrorAnnotations

packages/editor/src/lib/editor/Editor.ts:1682–1717  ·  view source on GitHub ↗

@internal

(origin: string, willCrashApp: boolean | 'unknown')

Source from the content-addressed store, hash-verified

1680
1681 /** @internal */
1682 createErrorAnnotations(origin: string, willCrashApp: boolean | 'unknown') {
1683 try {
1684 const editingShapeId = this.getEditingShapeId()
1685 return {
1686 tags: {
1687 origin: origin,
1688 willCrashApp,
1689 },
1690 extras: {
1691 activeStateNode: this.root.getPath(),
1692 selectedShapes: this.getSelectedShapes().map((s) => {
1693 const { props, ...rest } = s
1694 const { text: _text, richText: _richText, ...restProps } = props as any
1695 return {
1696 ...rest,
1697 props: restProps,
1698 }
1699 }),
1700 selectionCount: this.getSelectedShapes().length,
1701 editingShape: editingShapeId ? this.getShape(editingShapeId) : undefined,
1702 inputs: this.inputs.toJson(),
1703 pageState: this.getCurrentPageState(),
1704 instanceState: this.getInstanceState(),
1705 collaboratorCount: this.getCollaboratorsOnCurrentPage().length,
1706 },
1707 }
1708 } catch {
1709 return {
1710 tags: {
1711 origin: origin,
1712 willCrashApp,
1713 },
1714 extras: {},
1715 }
1716 }
1717 }
1718
1719 /** @internal */
1720 private _crashingError: unknown | null = null

Callers 2

annotateErrorMethod · 0.95

Calls 8

getEditingShapeIdMethod · 0.95
getSelectedShapesMethod · 0.95
getShapeMethod · 0.95
getCurrentPageStateMethod · 0.95
getInstanceStateMethod · 0.95
getPathMethod · 0.65
toJsonMethod · 0.45

Tested by

no test coverage detected