From 24f7bac3ea6e2ff32e0195cab9eba3b628335f98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=87=AA=E7=94=B1=E7=9A=84=E4=B8=96=E7=95=8C=E4=BA=BA?= <3196812536@qq.com> Date: Wed, 16 Jul 2025 15:36:20 +0800 Subject: [PATCH] refactor: custom mini app loading logic (#8181) * refactor: custom mini app loading logic Replaces try-catch with an explicit file existence check before reading 'custom-minapps.json'. Ensures the file is created with an empty array if it does not exist, improving clarity and error handling. * refactor: custom mini app loading logic Simplifies the loading of custom mini apps by removing the explicit file existence check and handling the read failure case directly. If reading the file fails, an empty array is written and returned. * fix: improve error handling in file reading for custom mini apps --- src/main/services/FileStorage.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/services/FileStorage.ts b/src/main/services/FileStorage.ts index b7a80c7f0b..1adecd5733 100644 --- a/src/main/services/FileStorage.ts +++ b/src/main/services/FileStorage.ts @@ -270,7 +270,7 @@ class FileStorage { } } catch (error) { logger.error(error) - return 'failed to read file' + throw new Error(`Failed to read file: ${filePath}.`) } }