mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-15 10:07:33 +02:00
docs(blog-only): add warning and improve error log (#9839)
This commit is contained in:
parent
34297bc56d
commit
a296d727b6
2 changed files with 20 additions and 4 deletions
|
@ -86,10 +86,20 @@ export const useAllDocsData = (): {[pluginId: string]: GlobalPluginData} =>
|
|||
}
|
||||
| undefined) ?? StableEmptyObject;
|
||||
|
||||
export const useDocsData = (pluginId: string | undefined): GlobalPluginData =>
|
||||
usePluginData('docusaurus-plugin-content-docs', pluginId, {
|
||||
failfast: true,
|
||||
}) as GlobalPluginData;
|
||||
export const useDocsData = (pluginId: string | undefined): GlobalPluginData => {
|
||||
try {
|
||||
return usePluginData('docusaurus-plugin-content-docs', pluginId, {
|
||||
failfast: true,
|
||||
}) as GlobalPluginData;
|
||||
} catch (error) {
|
||||
throw new Error(
|
||||
`You are using a feature of the Docusaurus docs plugin, but this plugin does not seem to be enabled${
|
||||
pluginId === 'Default' ? '' : ` (pluginId=${pluginId}`
|
||||
}`,
|
||||
{cause: error as Error},
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
// TODO this feature should be provided by docusaurus core
|
||||
export function useActivePlugin(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue