Skip to content

Commit

Permalink
include missing data in error message
Browse files Browse the repository at this point in the history
  • Loading branch information
sometimeskind committed Feb 26, 2018
1 parent bc9bf78 commit 76d7311
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions lib/utils/reconcile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down

0 comments on commit 76d7311

Please sign in to comment.