From e72fb9598cb2c28cbf5f75559f226277bce5451d Mon Sep 17 00:00:00 2001 From: nyagami Date: Wed, 21 Feb 2024 14:41:16 +0700 Subject: [PATCH] showToast if cancel epub --- src/services/epub/import.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/services/epub/import.ts b/src/services/epub/import.ts index 4fc8a2c12..2fe814822 100644 --- a/src/services/epub/import.ts +++ b/src/services/epub/import.ts @@ -18,6 +18,7 @@ import { BACKGROUND_ACTION, BackgoundAction } from '@services/constants'; import { getString } from '@strings/translations'; import { ChapterItem, SourceNovel } from '@plugins/types'; import { load as parseXML } from 'cheerio'; +import { showToast } from '@utils/showToast'; interface TaskData { delay: number; @@ -340,7 +341,8 @@ export const importEpub = async () => { copyToCacheDirectory: false, }); if (epubFile.type === 'cancel') { - throw new Error(getString('common.cancel')); + showToast(getString('common.cancel')); + return; } await BackgroundService.start(importEpubAction, { taskName: 'Import Epub',