From e1fbf5f18153d538cd6b0804f1fbef261d5abe70 Mon Sep 17 00:00:00 2001 From: ArthurHeitmann <37270165+ArthurHeitmann@users.noreply.github.com> Date: Fri, 9 Aug 2024 19:48:43 +0200 Subject: [PATCH] improve dat & dtt error messages --- lib/stateManagement/openFiles/types/WtaWtpData.dart | 6 +++--- lib/utils/utils.dart | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/stateManagement/openFiles/types/WtaWtpData.dart b/lib/stateManagement/openFiles/types/WtaWtpData.dart index 454ea0e3..03382a3b 100644 --- a/lib/stateManagement/openFiles/types/WtaWtpData.dart +++ b/lib/stateManagement/openFiles/types/WtaWtpData.dart @@ -49,13 +49,13 @@ class WtaWtpData extends OpenFileData { else { wtpPath = join(datDir, wtpName); if (!await File(wtpPath!).exists()) { - showToast("Can't find corresponding WTP file"); - throw Exception("Can't find corresponding WTP file"); + showToast("Can't find corresponding WTP file for $wtaName.wta in ${dttDir ?? datDir}"); + throw Exception("Can't find corresponding WTP file for $wtaName"); } } } if (!isWtb && wtpPath == null) { - showToast("Can't find corresponding WTP file"); + showToast("Can't find corresponding WTP file in ${dttDir ?? datDir}"); throw Exception("Can't find corresponding WTP file in ${dttDir ?? datDir}"); } diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart index c4be45a6..368f32a8 100644 --- a/lib/utils/utils.dart +++ b/lib/utils/utils.dart @@ -599,7 +599,12 @@ Future exportDat(String datFolder, { bool checkForNesting = false }) async } } var datExportPath = join(datExportDir, datName); - await repackDat(datFolder, datExportPath); + try { + await repackDat(datFolder, datExportPath); + } catch (e) { + messageLog.add("Failed to export $datName: $e"); + rethrow; + } if (recursive) await exportDat(datExportDir, checkForNesting: true);