Skip to content

Commit 27f9959

Browse files
committed
refactor: rm throw, add console warn and fallback
1 parent 074c989 commit 27f9959

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/components/LanguagePicker/useLanguagePicker.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,11 @@ export const useLanguagePicker = (
8888
const targetName = i18nConfigTarget || fallbackTarget
8989

9090
if (!sourceName || !targetName) {
91-
throw new Error(
92-
"Missing language display name, locale: " + localeOption
93-
)
91+
console.warn("Missing language display name:", {
92+
localeOption,
93+
sourceName,
94+
targetName,
95+
})
9496
}
9597

9698
// English will not have a dataItem
@@ -106,10 +108,9 @@ export const useLanguagePicker = (
106108
(dataItem!.words.approved / dataItem!.words.total) * 100
107109
) || 0
108110

109-
if (progressData.length === 0)
110-
throw new Error(
111-
"Missing translation progress data; check GitHub action"
112-
)
111+
if (progressData.length === 0) {
112+
console.warn("Missing translation progress data; check GitHub action")
113+
}
113114

114115
const totalWords = progressData[0].words.total
115116

@@ -123,8 +124,8 @@ export const useLanguagePicker = (
123124
return {
124125
localeOption,
125126
approvalProgress,
126-
sourceName,
127-
targetName,
127+
sourceName: sourceName ?? "",
128+
targetName: targetName ?? "",
128129
englishName,
129130
wordsApproved,
130131
isBrowserDefault,

0 commit comments

Comments
 (0)