forked from gatsbyjs/gatsby
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(gatsby-source-filesystem,gatsby-transformer-sharp): Use custom er…
…rors (gatsbyjs#27576)
- Loading branch information
1 parent
6a20a50
commit 5935379
Showing
3 changed files
with
47 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
export const CODES = { | ||
Generic: `10000`, | ||
MissingResource: `10001`, | ||
} | ||
|
||
export const pluginPrefix = `gatsby-source-filesystem` | ||
|
||
export function prefixId(id) { | ||
return `${pluginPrefix}_${id}` | ||
} | ||
|
||
// TODO: Refactor to use contextual data instead of only context.sourceMessage | ||
// once reporter.setErrorMap is guaranteed to be available | ||
export 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`, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters