Skip to content

Commit ef9efb9

Browse files
vladarGatsbyJS Bot
authored andcommitted
fix(gatsby-plugin-mdx): display better error message for MDX html field in development (#19111)
1 parent 57f2b69 commit ef9efb9

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/gatsby-plugin-mdx/gatsby/source-nodes.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ module.exports = (
184184
return html
185185
} catch (e) {
186186
reporter.error(
187-
`Error querying the \`html\` field. This field is intended for use with RSS feed generation.
187+
`gatsby-plugin-mdx: Error querying the \`html\` field.
188+
This field is intended for use with RSS feed generation.
188189
If you're trying to use it in application-level code, try querying for \`Mdx.body\` instead.
189190
Original error:
190191
${e}`

packages/gatsby-plugin-mdx/utils/render-html.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,8 @@ exports.mdxHTMLLoader = ({ cache, reporter, store }) =>
155155
keys.map(({ body }) =>
156156
renderMdxBody
157157
? renderMdxBody(body)
158-
: reporter.error(
159-
`gatsby-plugin-mdx: renderMdxBody was unavailable when rendering html.
160-
>> This is a bug.`
158+
: new Error(
159+
`renderMdxBody was unavailable when rendering html.`
161160
)
162161
)
163162
)

0 commit comments

Comments
 (0)