File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed
packages/gatsby-plugin-mdx/src Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -9,20 +9,24 @@ export const ERROR_CODES = {
9
9
export const ERROR_MAP = {
10
10
[ ERROR_CODES . MdxCompilation ] : {
11
11
text : ( context : { absolutePath : string ; errorMeta : any } ) : string =>
12
- `Failed to compile the file "${ context . absolutePath } ". Original error message: \n\n${ context . errorMeta . message } ` ,
12
+ `Failed to compile the file "${ context . absolutePath } ". Original error message:\n\n${ context . errorMeta . message } ` ,
13
13
level : `ERROR` ,
14
14
type : `PLUGIN` ,
15
15
category : `USER` ,
16
16
} ,
17
17
[ ERROR_CODES . NonExistentFileNode ] : {
18
- text : ( context : { resourcePath : string } ) : string =>
19
- `Unable to locate the GraphQL File node for ${ context . resourcePath } ` ,
18
+ text : ( context : { resourcePath : string ; mdxPath ?: string } ) : string =>
19
+ `Unable to locate the GraphQL File node for ${ context . resourcePath } ${
20
+ context . mdxPath ? `\nFile: ${ context . mdxPath } ` : ``
21
+ } `,
20
22
level : `ERROR` ,
21
23
type : `PLUGIN` ,
22
24
} ,
23
25
[ ERROR_CODES . InvalidAcornAST ] : {
24
- text : ( context : { resourcePath : string } ) : string =>
25
- `Invalid AST. Parsed source code did not return valid output. File:\n${ context . resourcePath } ` ,
26
+ text : ( context : { resourcePath : string ; mdxPath ?: string } ) : string =>
27
+ `Invalid AST. Parsed source code did not return valid output.\n\nTemplate:\n${
28
+ context . resourcePath
29
+ } ${ context . mdxPath ? `\nFile: ${ context . mdxPath } ` : `` } `,
26
30
level : `ERROR` ,
27
31
type : `PLUGIN` ,
28
32
category : `USER` ,
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ const gatsbyLayoutLoader: LoaderDefinition = async function (
39
39
id : ERROR_CODES . NonExistentFileNode ,
40
40
context : {
41
41
resourcePath : this . resourcePath ,
42
+ mdxPath,
42
43
} ,
43
44
} )
44
45
}
@@ -71,6 +72,7 @@ const gatsbyLayoutLoader: LoaderDefinition = async function (
71
72
id : ERROR_CODES . InvalidAcornAST ,
72
73
context : {
73
74
resourcePath : this . resourcePath ,
75
+ mdxPath,
74
76
} ,
75
77
} )
76
78
}
@@ -249,6 +251,7 @@ const gatsbyLayoutLoader: LoaderDefinition = async function (
249
251
id : ERROR_CODES . InvalidAcornAST ,
250
252
context : {
251
253
resourcePath : this . resourcePath ,
254
+ mdxPath,
252
255
} ,
253
256
error,
254
257
} )
You can’t perform that action at this time.
0 commit comments