Skip to content

Commit 867022a

Browse files
committed
Make gatsby-source-react-error-codes plugin fail harder
1 parent 9b02db3 commit 867022a

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

plugins/gatsby-source-react-error-codes/gatsby-node.js

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,23 @@ const errorCodesUrl =
66
exports.sourceNodes = async ({boundActionCreators}) => {
77
const {createNode} = boundActionCreators;
88

9-
const jsonString = await request(errorCodesUrl);
9+
try {
10+
const jsonString = await request(errorCodesUrl);
1011

11-
createNode({
12-
id: 'error-codes',
13-
children: [],
14-
parent: 'ERRORS',
15-
internal: {
16-
type: 'ErrorCodesJson',
17-
contentDigest: jsonString,
18-
},
19-
});
12+
createNode({
13+
id: 'error-codes',
14+
children: [],
15+
parent: 'ERRORS',
16+
internal: {
17+
type: 'ErrorCodesJson',
18+
contentDigest: jsonString,
19+
},
20+
});
21+
} catch (error) {
22+
console.error(
23+
`The gatsby-source-react-error-codes plugin has failed:\n${error.message}`,
24+
);
25+
26+
process.exit(1);
27+
}
2028
};

0 commit comments

Comments
 (0)