Skip to content

Commit

Permalink
chore(shape): throw error if source element undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
singerla committed May 31, 2024
1 parent 02d3d03 commit a675ebf
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/classes/shape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -88,6 +91,10 @@ export class Shape {
}

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

Expand Down

0 comments on commit a675ebf

Please sign in to comment.