Skip to content

Commit 96333ca

Browse files
malstoungregberge
authored andcommitted
fix: circular structure in error object (#60)
1 parent c96714c commit 96333ca

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/server/index.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -139,16 +139,15 @@ export function getLoadableState(
139139

140140
return Promise.all(mappedQueries).then(() => {
141141
if (errors.length > 0) {
142-
const error =
143-
errors.length === 1
144-
? errors[0]
145-
: new Error(
146-
`${
147-
errors.length
148-
} errors were thrown when importing your modules.`,
149-
)
150-
error.queryErrors = errors
151-
throw error
142+
if (errors.length === 1) {
143+
throw errors[0];
144+
} else {
145+
const err = new Error(
146+
`${errors.length} errors were thrown when importing your modules.`
147+
);
148+
err.queryErrors = errors
149+
throw err;
150+
}
152151
}
153152

154153
return new DeferredState(tree)

0 commit comments

Comments
 (0)