From a675ebfbf5a315da7b6bef9d7052fee989621b51 Mon Sep 17 00:00:00 2001 From: singerla Date: Fri, 31 May 2024 16:45:37 +0200 Subject: [PATCH] chore(shape): throw error if source element undefined --- src/classes/shape.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/classes/shape.ts b/src/classes/shape.ts index 12160a0..ab781c9 100644 --- a/src/classes/shape.ts +++ b/src/classes/shape.ts @@ -51,8 +51,11 @@ export class Shape { hasCreationId: boolean; contentTypeMap: typeof ContentTypeMap; subtype: ElementSubtype; + shape: ImportedElement; constructor(shape: ImportedElement, targetType: ShapeTargetType) { + this.shape = shape; + this.mode = shape.mode; this.name = shape.name; this.targetType = targetType; @@ -88,6 +91,10 @@ export class Shape { } async setTargetElement(): Promise { + if (!this.sourceElement) { + console.log(this.shape); + throw 'No source element for shape ' + this.name; + } this.targetElement = this.sourceElement.cloneNode(true) as XmlElement; }