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:
@@ -29,6 +29,7 @@ import { ChapterType, DownloadType } from '@/lib/graphql/generated/graphql.ts';
|
||||
import { TChapter } from '@/typings.ts';
|
||||
import { NavBarContext } from '@/components/context/NavbarContext.tsx';
|
||||
import { LoadingPlaceholder } from '@/components/util/LoadingPlaceholder.tsx';
|
||||
import { defaultPromiseErrorHandler } from '@/util/defaultPromiseErrorHandler.ts';
|
||||
|
||||
const HeightPreservingItem = ({ children, ...props }: BoxProps) => (
|
||||
// the height is necessary to prevent the item container from collapsing, which confuses Virtuoso measurements
|
||||
@@ -203,7 +204,7 @@ export const DownloadQueue: React.FC = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
requestManager.startDownloads().response.catch(() => {});
|
||||
requestManager.startDownloads().response.catch(defaultPromiseErrorHandler('DownloadQueue::startDownloads'));
|
||||
};
|
||||
|
||||
if (isLoading) {
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -25,6 +25,7 @@ import { LoadingPlaceholder } from '@/components/util/LoadingPlaceholder';
|
||||
import { GetAboutQuery, UpdateState } from '@/lib/graphql/generated/graphql.ts';
|
||||
import { ABOUT_WEBUI, WEBUI_UPDATE_CHECK } from '@/lib/graphql/Fragments.ts';
|
||||
import { makeToast } from '@/components/util/Toast.tsx';
|
||||
import { defaultPromiseErrorHandler } from '@/util/defaultPromiseErrorHandler.ts';
|
||||
|
||||
type AboutServer = GetAboutQuery['aboutServer'];
|
||||
|
||||
@@ -224,7 +225,9 @@ export function About() {
|
||||
|
||||
const resetUpdateStatus = isError || updateFinished;
|
||||
if (resetUpdateStatus) {
|
||||
requestManager.resetWebUIUpdateStatus().response.catch(() => {});
|
||||
requestManager
|
||||
.resetWebUIUpdateStatus()
|
||||
.response.catch(defaultPromiseErrorHandler('About::resetWebUIUpdateStatus'));
|
||||
}
|
||||
|
||||
if (!updateFinished) {
|
||||
@@ -326,7 +329,11 @@ export function About() {
|
||||
isUpdateAvailable={isWebUIUpdateAvailable}
|
||||
updateCheckError={webUIUpdateCheckError}
|
||||
checkForUpdate={checkForWebUIUpdate}
|
||||
triggerUpdate={() => requestManager.updateWebUI().response.catch(() => {})}
|
||||
triggerUpdate={() =>
|
||||
requestManager
|
||||
.updateWebUI()
|
||||
.response.catch(defaultPromiseErrorHandler('About::updateWebUI'))
|
||||
}
|
||||
progress={webUIUpdateProgress}
|
||||
updateState={webUIUpdateState}
|
||||
/>
|
||||
|
||||
@@ -20,6 +20,7 @@ import {
|
||||
import { ReaderSettingsOptions } from '@/components/reader/ReaderSettingsOptions';
|
||||
import { makeToast } from '@/components/util/Toast';
|
||||
import { NavBarContext, useSetDefaultBackTo } from '@/components/context/NavbarContext';
|
||||
import { defaultPromiseErrorHandler } from '@/util/defaultPromiseErrorHandler.ts';
|
||||
|
||||
export function DefaultReaderSettings() {
|
||||
const { t } = useTranslation();
|
||||
@@ -58,7 +59,7 @@ export function DefaultReaderSettings() {
|
||||
{ meta: convertToGqlMeta(metadata)! },
|
||||
'server',
|
||||
getDefaultSettings(),
|
||||
).catch(() => {});
|
||||
).catch(defaultPromiseErrorHandler('DefaultReaderSettings::checkAndHandleMissingStoredReaderSettings'));
|
||||
|
||||
return (
|
||||
<ReaderSettingsOptions
|
||||
|
||||
Reference in New Issue
Block a user