Skip to content

Commit

Permalink
fix: Improve error handling and remove unnecessary async
Browse files Browse the repository at this point in the history
Enhanced error handling in `ProcessUtils.cs` by adding detailed error messages and throwing `InvalidOperationException`. Removed the unnecessary ` async ` keyword from `LoadGameData` in `PosterPickerViewModel.cs` as the method does not contain any async operations.
  • Loading branch information
DineshSolanki committed Jul 27, 2024
1 parent 49db1e2 commit 95d2a19
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions FoliCon/Modules/utils/ProcessUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ public static void StartProcess(string path)
}
catch (Exception e)
{
Logger.Error(e, "Failed to start process: {ExceptionMessage}", e.Message);
throw;
var detailedErrorMessage = $"Failed to start process at path: {path}. Exception: {e.Message}";

Logger.Error(e, detailedErrorMessage);
throw new InvalidOperationException(detailedErrorMessage, e);
}
}

Expand Down
4 changes: 2 additions & 2 deletions FoliCon/ViewModels/PosterPickerViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public async Task LoadData()

if (resultType == MediaTypes.Game)
{
await LoadGameData(response);
LoadGameData(response);
}
else
{
Expand Down Expand Up @@ -177,7 +177,7 @@ private async Task<ImagesWithId> GetTitleAndImages(string resultType, dynamic re
};
}

private async Task LoadGameData(dynamic response)
private void LoadGameData(dynamic response)
{
Logger.Debug("Media Type is Game, loading images from IGDB");
Artwork[] images = response.Artworks.Values;
Expand Down

0 comments on commit 95d2a19

Please sign in to comment.