From 7307a3350da56b79670833643b5d7e0d30513280 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Wed, 11 Dec 2024 22:40:06 +0100 Subject: [PATCH] Catch uncaught promise --- src/modules/reader/services/ReaderControls.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/modules/reader/services/ReaderControls.ts b/src/modules/reader/services/ReaderControls.ts index 4f3b7fcc..76208cce 100644 --- a/src/modules/reader/services/ReaderControls.ts +++ b/src/modules/reader/services/ReaderControls.ts @@ -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})`);