UNPKG

@tldraw/utils

Version:

tldraw infinite canvas SDK (private utilities).

30 lines (29 loc) 821 B
const annotationsByError = /* @__PURE__ */ new WeakMap(); function annotateError(error, annotations) { if (typeof error !== "object" || error === null) return; let currentAnnotations = annotationsByError.get(error); if (!currentAnnotations) { currentAnnotations = { tags: {}, extras: {} }; annotationsByError.set(error, currentAnnotations); } if (annotations.tags) { currentAnnotations.tags = { ...currentAnnotations.tags, ...annotations.tags }; } if (annotations.extras) { currentAnnotations.extras = { ...currentAnnotations.extras, ...annotations.extras }; } } function getErrorAnnotations(error) { return annotationsByError.get(error) ?? { tags: {}, extras: {} }; } export { annotateError, getErrorAnnotations }; //# sourceMappingURL=error.mjs.map