mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-03 19:32:35 +02:00
refactor(v2): cleanup console output (#4979)
* refactor(v2): cleanup console output * fix jest issue Co-authored-by: slorber <lorber.sebastien@gmail.com>
This commit is contained in:
parent
8501db78a1
commit
41d9288e3d
86 changed files with 382 additions and 339 deletions
|
@ -158,7 +158,7 @@ export function useDocsPreferredVersionContext(): DocsPreferredVersionContextVal
|
|||
const value = useContext(Context);
|
||||
if (!value) {
|
||||
throw new Error(
|
||||
"Can't find docs preferred context, maybe you forgot to use the DocsPreferredVersionContextProvider ?",
|
||||
'Can\'t find docs preferred context, maybe you forgot to use the "DocsPreferredVersionContextProvider"?',
|
||||
);
|
||||
}
|
||||
return value;
|
||||
|
|
|
@ -18,7 +18,7 @@ function getBrowserStorage(
|
|||
): Storage | null {
|
||||
if (typeof window === 'undefined') {
|
||||
throw new Error(
|
||||
'Browser storage is not available on NodeJS / Docusaurus SSR process',
|
||||
'Browser storage is not available on Node.js/Docusaurus SSR process.',
|
||||
);
|
||||
}
|
||||
if (storageType === 'none') {
|
||||
|
@ -42,7 +42,7 @@ function logOnceBrowserStorageNotAvailableWarning(error: Error) {
|
|||
if (!hasLoggedBrowserStorageNotAvailableWarning) {
|
||||
console.warn(
|
||||
`Docusaurus browser storage is not available.
|
||||
Possible reasons: running Docusaurus in an Iframe, in an Incognito browser session, or using too strict browser privacy settings.`,
|
||||
Possible reasons: running Docusaurus in an iframe, in an incognito browser session, or using too strict browser privacy settings.`,
|
||||
error,
|
||||
);
|
||||
hasLoggedBrowserStorageNotAvailableWarning = true;
|
||||
|
@ -65,7 +65,7 @@ const NoopStorageSlot: StorageSlot = {
|
|||
// Fail-fast, as storage APIs should not be used during the SSR process
|
||||
function createServerStorageSlot(key: string): StorageSlot {
|
||||
function throwError(): never {
|
||||
throw new Error(`Illegal storage API usage for storage key=${key}.
|
||||
throw new Error(`Illegal storage API usage for storage key "${key}".
|
||||
Docusaurus storage APIs are not supposed to be called on the server-rendering process.
|
||||
Please only call storage APIs in effects and event handlers.`);
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ function useLocalePluralForms(): LocalePluralForms {
|
|||
try {
|
||||
return createLocalePluralForms(currentLocale);
|
||||
} catch (e) {
|
||||
console.error(`Failed to use Intl.PluralRules for locale=${currentLocale}.
|
||||
console.error(`Failed to use Intl.PluralRules for locale "${currentLocale}".
|
||||
Docusaurus will fallback to a default/fallback (English) Intl.PluralRules implementation.
|
||||
`);
|
||||
return EnglishPluralForms;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue