polish(theme): better error messages on navbar item rendering failures + ErrorCauseBoundary API (#8735)

Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
This commit is contained in:
Tanner Dolby 2023-03-09 10:56:21 -07:00 committed by GitHub
parent 7961c5b8d5
commit ea2b13ea94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 98 additions and 9 deletions

View file

@ -310,8 +310,8 @@ export function useLayoutDocsSidebar(
`Can't find any sidebar with id "${sidebarId}" in version${
versions.length > 1 ? 's' : ''
} ${versions.map((version) => version.name).join(', ')}".
Available sidebar ids are:
- ${Object.keys(allSidebars).join('\n- ')}`,
Available sidebar ids are:
- ${Object.keys(allSidebars).join('\n- ')}`,
);
}
return sidebarEntry[1];
@ -343,9 +343,9 @@ export function useLayoutDoc(
return null;
}
throw new Error(
`DocNavbarItem: couldn't find any doc with id "${docId}" in version${
`Couldn't find any doc with id "${docId}" in version${
versions.length > 1 ? 's' : ''
} ${versions.map((version) => version.name).join(', ')}".
} "${versions.map((version) => version.name).join(', ')}".
Available doc ids are:
- ${uniq(allDocs.map((versionDoc) => versionDoc.id)).join('\n- ')}`,
);