Skip to content

Commit a675ebf

Browse files
committed
chore(shape): throw error if source element undefined
1 parent 02d3d03 commit a675ebf

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/classes/shape.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,11 @@ export class Shape {
5151
hasCreationId: boolean;
5252
contentTypeMap: typeof ContentTypeMap;
5353
subtype: ElementSubtype;
54+
shape: ImportedElement;
5455

5556
constructor(shape: ImportedElement, targetType: ShapeTargetType) {
57+
this.shape = shape;
58+
5659
this.mode = shape.mode;
5760
this.name = shape.name;
5861
this.targetType = targetType;
@@ -88,6 +91,10 @@ export class Shape {
8891
}
8992

9093
async setTargetElement(): Promise<void> {
94+
if (!this.sourceElement) {
95+
console.log(this.shape);
96+
throw 'No source element for shape ' + this.name;
97+
}
9198
this.targetElement = this.sourceElement.cloneNode(true) as XmlElement;
9299
}
93100

0 commit comments

Comments
 (0)