Browse Source

Merge pull request #214 from reactjs/gatsby-plugin-error-codes-fix

Make gatsby-source-react-error-codes plugin fail harder
main
Brian Vaughn 8 years ago
committed by GitHub
parent
commit
40de6b302e
  1. 28
      plugins/gatsby-source-react-error-codes/gatsby-node.js

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

@ -6,15 +6,23 @@ const errorCodesUrl =
exports.sourceNodes = async ({boundActionCreators}) => { exports.sourceNodes = async ({boundActionCreators}) => {
const {createNode} = boundActionCreators; const {createNode} = boundActionCreators;
const jsonString = await request(errorCodesUrl); try {
const jsonString = await request(errorCodesUrl);
createNode({ createNode({
id: 'error-codes', id: 'error-codes',
children: [], children: [],
parent: 'ERRORS', parent: 'ERRORS',
internal: { internal: {
type: 'ErrorCodesJson', type: 'ErrorCodesJson',
contentDigest: jsonString, contentDigest: jsonString,
}, },
}); });
} catch (error) {
console.error(
`The gatsby-source-react-error-codes plugin has failed:\n${error.message}`,
);
process.exit(1);
}
}; };

Loading…
Cancel
Save