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