Log promise failures instead of ignoring them (#531)

In case the failure does not get handled, it should at least get logged, to prevent silently ignoring it
This commit is contained in:
schroda
2023-12-31 01:42:54 +01:00
committed by GitHub
parent 37d6b84cf4
commit 37ce494fda
10 changed files with 44 additions and 13 deletions

View File

@@ -30,6 +30,7 @@ import { NavBarContext } from '@/components/context/NavbarContext.tsx';
import { useDebounce } from '@/util/useDebounce.ts';
import { UpdateChapterPatchInput } from '@/lib/graphql/generated/graphql.ts';
import { useMetadataServerSettings } from '@/util/metadataServerSettings.ts';
import { defaultPromiseErrorHandler } from '@/util/defaultPromiseErrorHandler.ts';
const isDupChapter = async (chapterIndex: number, currentChapter: TChapter) => {
const nextChapter = await requestManager.getChapter(currentChapter.manga.id, chapterIndex).response;
@@ -209,7 +210,7 @@ export function Reader() {
chapterIdToDelete: getChapterIdToDelete(),
downloadAheadMangaId: shouldDownloadAhead ? chapter.manga.id : undefined,
})
.response.catch(() => {});
.response.catch();
};
const setSettingValue = (key: keyof IReaderSettings, value: string | boolean) => {
@@ -264,7 +265,9 @@ export function Reader() {
useEffect(() => {
if (!areDefaultSettingsLoading && !isMangaLoading) {
checkAndHandleMissingStoredReaderSettings(manga, 'manga', defaultSettings).catch(() => {});
checkAndHandleMissingStoredReaderSettings(manga, 'manga', defaultSettings).catch(
defaultPromiseErrorHandler('Reader::checkAndHandleMissingStoredReaderSettings'),
);
setSettings(getReaderSettingsFor(manga, defaultSettings));
}
}, [areDefaultSettingsLoading, isMangaLoading]);