From 1de26d3c5d8daf4ab6d8a08cd0dd7155e1806d66 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 12 Aug 2016 09:30:02 -0700 Subject: [PATCH] [API] Throw error on containment violation --- src/api/composition/CompositionCollection.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/api/composition/CompositionCollection.js b/src/api/composition/CompositionCollection.js index 3d988036ac..591085a629 100644 --- a/src/api/composition/CompositionCollection.js +++ b/src/api/composition/CompositionCollection.js @@ -52,6 +52,9 @@ define([ if (!this._children) { throw new Error("Must load composition before you can add!"); } + if (!this.canContain(child)) { + throw new Error("This object cannot contain that object."); + } if (this.contains(child)) { if (skipMutate) { return; // don't add twice, don't error.