Skip to content

Commit ff1acea

Browse files
LisaManresapaulfalgout
authored andcommitted
Throw error on _startChildApp if child app does not exist
1 parent 4a51cd5 commit ff1acea

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/mixins/child-apps.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,11 @@ export default {
133133
*/
134134
startChildApp(appName, options) {
135135
const childApp = this.getChildApp(appName);
136+
137+
if (!childApp) {
138+
throw new Error(`A child app with the name ${ appName } does not exist.`);
139+
}
140+
136141
return this._startChildApp(childApp, options);
137142
},
138143

test/unit/mixins/child-apps.spec.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,14 @@ describe('ChildAppMixin', function() {
369369
expect(this.myChildApp.isRunning()).to.be.true;
370370
});
371371

372+
it('should throw an error if childApp does not exist', function() {
373+
try {
374+
this.myApp.startChildApp('cA0');
375+
} catch (e) {
376+
expect(e.message).to.equal('A child app with the name cA0 does not exist.');
377+
}
378+
});
379+
372380
it('should start childApp with options', function() {
373381
this.myChildApp = this.myApp.startChildApp('cA2', { foo: 'bar' });
374382

0 commit comments

Comments
 (0)