add runtime error handling to rope

This commit is contained in:
“chrisshank” 2024-11-24 15:57:14 -08:00
parent 07ef31d6b2
commit b8aae90d1b
1 changed files with 6 additions and 2 deletions

View File

@ -101,7 +101,11 @@ export class EventPropagator extends FolkRope {
// Do we need the event at all?
evaluateExpression = (event?: Event) => {
if (this.sourceElement === null || this.targetElement === null) return;
this.#function(this.sourceElement, this.targetElement, event);
this.stroke = 'black';
try {
this.#function(this.sourceElement, this.targetElement, event);
} catch (error) {
this.stroke = 'red';
}
};
}