Skip to content

Commit 9d69f61

Browse files
更健壮的数据库错误处理
1 parent d281ae5 commit 9d69f61

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/contestEditor/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,13 @@ const ContestEditorWithInitalPromise: FC<{
354354

355355
const ContestEditor: FC = () => {
356356
const initialPromise = (async () => {
357-
const stored = await loadConfigFromDB();
357+
const stored = await loadConfigFromDB().catch((e) => {
358+
console.warn(
359+
"Error when loading config from DB. Will use default config.",
360+
e,
361+
);
362+
return undefined;
363+
});
358364

359365
if (!stored)
360366
return {

0 commit comments

Comments
 (0)