From 96df4ad67fb68a108907006765ae7a1b67538bd7 Mon Sep 17 00:00:00 2001 From: Louis Date: Sun, 18 Feb 2024 23:05:36 +0700 Subject: [PATCH] fix: move jan data folder - error handling - no write permission granted (#2077) --- web/screens/Settings/Advanced/DataFolder/index.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/web/screens/Settings/Advanced/DataFolder/index.tsx b/web/screens/Settings/Advanced/DataFolder/index.tsx index fe590bfaa..f9c2f440a 100644 --- a/web/screens/Settings/Advanced/DataFolder/index.tsx +++ b/web/screens/Settings/Advanced/DataFolder/index.tsx @@ -83,7 +83,11 @@ const DataFolder = () => { await window.core?.api?.getAppConfigurations() const currentJanDataFolder = appConfiguration.data_folder appConfiguration.data_folder = destinationPath - await fs.syncFile(currentJanDataFolder, destinationPath) + const { _, err } = await fs.syncFile( + currentJanDataFolder, + destinationPath + ) + if (err) throw err await window.core?.api?.updateAppConfiguration(appConfiguration) console.debug( `File sync finished from ${currentJanDataFolder} to ${destinationPath}` @@ -94,7 +98,7 @@ const DataFolder = () => { }, 1200) await window.core?.api?.relaunch() } catch (e) { - console.error(`Error: ${e}`) + console.error(e) setShowLoader(false) setShowChangeFolderError(true) }