From a41faacd81837cfe1fad16aae08a17a1081ec16d Mon Sep 17 00:00:00 2001 From: Salvador Cipolla Date: Mon, 1 Dec 2025 21:25:37 -0300 Subject: [PATCH] Inform mod fetching errors during mod install --- Knossos.NET/Models/Mod.cs | 6 +++++- .../ViewModels/Windows/ModInstallViewModel.cs | 12 +++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Knossos.NET/Models/Mod.cs b/Knossos.NET/Models/Mod.cs index b33f3d81..409ba3e2 100644 --- a/Knossos.NET/Models/Mod.cs +++ b/Knossos.NET/Models/Mod.cs @@ -760,8 +760,9 @@ public void SaveJson() /// Uses the new API call introduced along with repo_minimal.json to load the missing data from Nebula using the api /// Can be called multiple times, the data is only loaded once unless ClearUnusedData() is called on this mod object /// Does nothing for installed mods + /// Returns true if the operation was successfull, false otherwise. /// - public async Task LoadFulLNebulaData() + public async Task LoadFulLNebulaData() { if(!installed && !fullDataLoaded) { @@ -788,12 +789,15 @@ public async Task LoadFulLNebulaData() modFlag = newData.modFlag; customBuild = newData.customBuild; owners = newData.owners; + return true; } }catch(Exception ex) { Log.Add(Log.LogSeverity.Error, "Mod.LoadFulLNebulaData", ex); } + return false; } + return true; } /// diff --git a/Knossos.NET/ViewModels/Windows/ModInstallViewModel.cs b/Knossos.NET/ViewModels/Windows/ModInstallViewModel.cs index b7be6145..07aa98a5 100644 --- a/Knossos.NET/ViewModels/Windows/ModInstallViewModel.cs +++ b/Knossos.NET/ViewModels/Windows/ModInstallViewModel.cs @@ -160,7 +160,9 @@ private async void UpdateSelectedVersion() List allMods; if(SelectedMod != null) { - await SelectedMod.LoadFulLNebulaData(); + var successfull = await SelectedMod.LoadFulLNebulaData(); + if (!successfull) + _ = MessageBox.Show(MainWindow.instance, "An error has ocurred while fetching data from nebula for mod " + SelectedMod, "Error fetching data", MessageBox.MessageBoxButtons.OK); } //load all dependencies mods in singletc mode so they can be modified too at any time if(SelectedMod != null && !SelectedMod.GetMissingDependenciesList().Any() && !Knossos.inSingleTCMode) @@ -353,7 +355,9 @@ private async Task ProcessMod(Mod mod, List allMods, List? processed = else { //Load Nebula data first to check the packages and add to cache - await modDep.LoadFulLNebulaData(); + var successfull = await modDep.LoadFulLNebulaData(); + if (!successfull) + _ = MessageBox.Show(MainWindow.instance, "An error has ocurred while fetching data from nebula for mod " + modDep, "Error fetching data", MessageBox.MessageBoxButtons.OK); modCache.Add(modDep); } @@ -384,7 +388,9 @@ private async Task ProcessMod(Mod mod, List allMods, List? processed = else { //Load Nebula data first to check the packages and add to cache - await alternativeVersion.LoadFulLNebulaData(); + var successfull = await alternativeVersion.LoadFulLNebulaData(); + if (!successfull) + _ = MessageBox.Show(MainWindow.instance, "An error has ocurred while fetching data from nebula for mod " + alternativeVersion, "Error fetching data", MessageBox.MessageBoxButtons.OK); modCache.Add(alternativeVersion); } }