Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
reportError(message) {
const queryErrorMessage = `${report.format.red(`GraphQL Error`)} ${message}`
report.panicOnBuild(queryErrorMessage)
if (process.env.gatsby_executing_command === `develop`) {
websocketManager.emitError(overlayErrorID, queryErrorMessage)
lastRunHadErrors = true
}
}
}
if (query.isStaticQuery) {
query.jsonName =
`sq--` +
_.kebabCase(
`${path.relative(store.getState().program.directory, filePath)}`
)
}
if (
query.isHook &&
process.env.NODE_ENV === `production` &&
typeof require(`react`).useContext !== `function`
) {
report.panicOnBuild(
`You're likely using a version of React that doesn't support Hooks\n` +
`Please update React and ReactDOM to 16.8.0 or later to use the useStaticQuery hook.`
)
}
compiledNodes.set(filePath, query)
})
}
if (query.isStaticQuery) {
query.id =
`sq--` +
_.kebabCase(
`${path.relative(store.getState().program.directory, filePath)}`
)
}
if (
query.isHook &&
process.env.NODE_ENV === `production` &&
typeof require(`react`).useContext !== `function`
) {
report.panicOnBuild(
`You're likely using a version of React that doesn't support Hooks\n` +
`Please update React and ReactDOM to 16.8.0 or later to use the useStaticQuery hook.`
)
}
compiledNodes.set(filePath, query)
})
reportError(message) {
const queryErrorMessage = `${report.format.red(`GraphQL Error`)} ${message}`
report.panicOnBuild(queryErrorMessage)
if (process.env.gatsby_executing_command === `develop`) {
websocketManager.emitError(overlayErrorID, queryErrorMessage)
lastRunHadErrors = true
}
}