From 96333ca22815ce65da3aa10484375dc4b42718d7 Mon Sep 17 00:00:00 2001 From: Andrey Date: Fri, 6 Apr 2018 00:05:22 +0300 Subject: [PATCH] fix: circular structure in error object (#60) --- src/server/index.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/server/index.js b/src/server/index.js index 87823b6e..d341c973 100644 --- a/src/server/index.js +++ b/src/server/index.js @@ -139,16 +139,15 @@ export function getLoadableState( return Promise.all(mappedQueries).then(() => { if (errors.length > 0) { - const error = - errors.length === 1 - ? errors[0] - : new Error( - `${ - errors.length - } errors were thrown when importing your modules.`, - ) - error.queryErrors = errors - throw error + if (errors.length === 1) { + throw errors[0]; + } else { + const err = new Error( + `${errors.length} errors were thrown when importing your modules.` + ); + err.queryErrors = errors + throw err; + } } return new DeferredState(tree)