From 76d7311b4579020d3c5a382e06efff66d9bb2295 Mon Sep 17 00:00:00 2001 From: Tom Ruttle Date: Mon, 26 Feb 2018 13:32:06 +0000 Subject: [PATCH] include missing data in error message --- lib/utils/reconcile.js | 10 ++++++---- package.json | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/utils/reconcile.js b/lib/utils/reconcile.js index 288c0e9..4d7ba71 100644 --- a/lib/utils/reconcile.js +++ b/lib/utils/reconcile.js @@ -39,9 +39,10 @@ export default function initReconcile(config: ConfigType) { } const appFragments = appFragmentNames.map((fragmentName) => fragments[fragmentName]); + const missingFragments = appFragments.filter((fragment) => !fragment); - if (!appFragments.every(Boolean)) { - throw new AppManagerError(`App ${appName} tried to mount at least one missing fragment.`, Object.assign({}, errData, { + if (missingFragments.length > 0) { + throw new AppManagerError(`App ${appName} tried to mount at least one missing fragment: ${missingFragments.join(', ')}`, Object.assign({}, errData, { level: levels.ERROR, code: 'missing_fragment', recoverable: false, @@ -64,9 +65,10 @@ export default function initReconcile(config: ConfigType) { .reduce((empty, slotName) => Object.assign(empty, { [slotName]: null }), {}); const mountableSlots = Object.keys(emptySlots).map((slotName) => slots[slotName]); + const missingSlots = mountableSlots.filter((slot) => !slot); - if (!mountableSlots.every(Boolean)) { - throw new AppManagerError(`App ${appName} tried to mount into at least one missing slot.`, Object.assign({}, errData, { + if (missingSlots.length > 0) { + throw new AppManagerError(`App ${appName} tried to mount into at least one missing slot: ${missingSlots.join(', ')}`, Object.assign({}, errData, { level: levels.ERROR, code: 'invalid_slots', recoverable: false, diff --git a/package.json b/package.json index 3a49732..6dd793c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "app-manager", - "version": "0.22.1", + "version": "0.22.2", "description": "Script for managing the lifecycles of multiple apps on a single page", "main": "es5/index.js", "scripts": {