Open olavea opened 2 years ago
Got an error:
ReferenceError: CODES is not defined
// gatsby-node.js // Cap Ola Vea adds Gatsby's structured logs const ERROR_MAP = { [CODES.Generic]: { text: (context) => context.sourceMessage, level: `ERROR`, type: `PLUGIN`, }, [CODES.MissingResource]: { text: (context) => context.sourceMessage, level: `ERROR`, type: `PLUGIN`, category: `USER`, }, }; const initializePlugin = ({ reporter }) => { if (reporter.setErrorMap) { reporter.setErrorMap(ERROR_MAP); } }; // need to conditionally export otherwise it throws an error for older versions if (coreSupportsOnPluginInit === "stable") { exports.onPluginInit = initializePlugin; } else if (coreSupportsOnPluginInit === "unstable") { exports.unstable_onPluginInit = initializePlugin; } else { exports.onPreInit = initializePlugin; }
depend on 🦁
Would need to define CODES, but we don't really need this I think. But could be interesting for me to look into for better plugin error handling.
Got an error:
ReferenceError: CODES is not defined
depend on 🦁