Catch uncaught promise

This commit is contained in:
schroda
2024-12-11 22:40:06 +01:00
parent 6dd2c8e2ff
commit 7307a3350d

View File

@@ -39,6 +39,7 @@ import { DirectionOffset, TranslationKey } from '@/Base.types.ts';
import { useMetadataServerSettings } from '@/modules/settings/services/ServerSettingsMetadata.ts';
import { TChapterReader } from '@/modules/chapter/Chapter.types.ts';
import { awaitConfirmation } from '@/modules/core/utils/AwaitableDialog.tsx';
import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts';
const getScrollDirectionInvert = (
scrollDirection: ScrollDirection,
@@ -162,14 +163,14 @@ export class ReaderControls {
(offset) => {
switch (offset) {
case 'previous':
ReaderControls.checkNextChapterConsistency(t, offset, currentChapter, previousChapter).then(
openPreviousChapter,
);
ReaderControls.checkNextChapterConsistency(t, offset, currentChapter, previousChapter)
.then(openPreviousChapter)
.catch(defaultPromiseErrorHandler('ReaderControls::checkNextChapterConsistency: previous'));
break;
case 'next':
ReaderControls.checkNextChapterConsistency(t, offset, currentChapter, nextChapter).then(
openNextChapter,
);
ReaderControls.checkNextChapterConsistency(t, offset, currentChapter, nextChapter)
.then(openNextChapter)
.catch(defaultPromiseErrorHandler('ReaderControls::checkNextChapterConsistency: next'));
break;
default:
throw new Error(`Unexpected "offset" (${offset})`);