UNPKG

614 BJavaScriptView Raw
1export const CODES = {
2 Generic: `20000`,
3 MissingResource: `20001`,
4}
5
6export const pluginPrefix = `gatsby-transformer-sharp`
7
8export function prefixId(id) {
9 return `${pluginPrefix}_${id}`
10}
11
12// TODO: Refactor to use contextual data instead of only context.sourceMessage
13// once reporter.setErrorMap is guaranteed to be available
14export const ERROR_MAP = {
15 [CODES.Generic]: {
16 text: context => context.sourceMessage,
17 level: `ERROR`,
18 type: `PLUGIN`,
19 },
20 [CODES.MissingResource]: {
21 text: context => context.sourceMessage,
22 level: `ERROR`,
23 type: `PLUGIN`,
24 category: `USER`,
25 },
26}