You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: add more meaningful error message when nested slices are used (#36800)
* fix: add more meaningful error message when nested slices are used
* add more contextual information if available
* Update packages/gatsby/cache-dir/slice.js
Co-authored-by: Josh Johnson <[email protected]>
Co-authored-by: Josh Johnson <[email protected]>
// just in case generating additional contextual information fails, we still want the base message to show
41
+
// and not show another cryptic error message
42
+
try{
43
+
additionalContextMessage=`\n\nSlice component "${slicesContext.sliceRoot.name}" (${slicesContext.sliceRoot.componentPath}) tried to render <Slice alias="${props.alias}"/>`
44
+
}catch{
45
+
// don't need to handle it, we will just skip the additional context message if we fail to generate it
46
+
}
47
+
48
+
thrownewError(
49
+
`Nested slices are not supported.${additionalContextMessage}\n\nSee https://v5.gatsbyjs.com/docs/reference/built-in-components/gatsby-slice#nested-slices`
50
+
)
35
51
}else{
36
52
thrownewError(
37
53
`Slice context "${slicesContext.renderEnvironment}" is not supported.`
0 commit comments