mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-11 16:17:25 +02:00
fix(content-docs): give context about sidebar loading failure (#6887)
This commit is contained in:
parent
e842b40a54
commit
ff0d981853
1 changed files with 19 additions and 12 deletions
|
@ -98,16 +98,23 @@ export async function loadSidebars(
|
|||
sidebarFilePath: string | false | undefined,
|
||||
options: SidebarProcessorParams,
|
||||
): Promise<Sidebars> {
|
||||
const sidebarsConfig = await loadSidebarsFileUnsafe(sidebarFilePath);
|
||||
const normalizedSidebars = normalizeSidebars(sidebarsConfig);
|
||||
validateSidebars(normalizedSidebars);
|
||||
const categoriesMetadata = await readCategoriesMetadata(
|
||||
options.version.contentPath,
|
||||
);
|
||||
const processedSidebars = await processSidebars(
|
||||
normalizedSidebars,
|
||||
categoriesMetadata,
|
||||
options,
|
||||
);
|
||||
return postProcessSidebars(processedSidebars, options);
|
||||
try {
|
||||
const sidebarsConfig = await loadSidebarsFileUnsafe(sidebarFilePath);
|
||||
const normalizedSidebars = normalizeSidebars(sidebarsConfig);
|
||||
validateSidebars(normalizedSidebars);
|
||||
const categoriesMetadata = await readCategoriesMetadata(
|
||||
options.version.contentPath,
|
||||
);
|
||||
const processedSidebars = await processSidebars(
|
||||
normalizedSidebars,
|
||||
categoriesMetadata,
|
||||
options,
|
||||
);
|
||||
return postProcessSidebars(processedSidebars, options);
|
||||
} catch (err) {
|
||||
logger.error`Sidebars file at path=${
|
||||
sidebarFilePath as string
|
||||
} failed to be loaded.`;
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue