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
This commit is contained in:
自由的世界人 2025-07-16 15:36:20 +08:00 committed by GitHub
parent 0930201e5d
commit 24f7bac3ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -270,7 +270,7 @@ class FileStorage {
}
} catch (error) {
logger.error(error)
return 'failed to read file'
throw new Error(`Failed to read file: ${filePath}.`)
}
}