Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Wauncher/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public override async void OnFrameworkInitializationCompleted()
}
catch (Exception ex)
{
ErrorLogger.LogError("App.OnFrameworkInitializationCompleted", ex, "Application startup validation failed");
ConsoleManager.ShowError($"Startup error: {ex.Message}");
desktop.Shutdown();
return;
Expand Down Expand Up @@ -104,8 +105,9 @@ private static bool IsSteamRunning()
{
return Process.GetProcessesByName("steam").Length > 0;
}
catch
catch (Exception ex)
{
ErrorLogger.LogError("App.IsSteamRunning", ex, "Failed to check if Steam is running");
return false;
}
}
Expand Down Expand Up @@ -150,6 +152,7 @@ private void SetupTrayIcon()
}
catch (Exception ex)
{
ErrorLogger.LogError("App.SetupTrayIcon", ex, "Failed to load tray icon");
// Tray icon is optional, log but don't fail
System.Diagnostics.Debug.WriteLine($"Failed to load tray icon: {ex.Message}");
}
Expand Down
23 changes: 4 additions & 19 deletions Wauncher/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,7 @@ public static void Main(string[] args)
}
catch (Exception ex)
{
try
{
var logPath = Path.Combine(Path.GetDirectoryName(System.Environment.ProcessPath) ?? ".", "wauncher_error.log");
File.WriteAllText(logPath, $"{DateTime.Now:yyyy-MM-dd HH:mm:ss}\n{ex}");
}
catch
{
}

ErrorLogger.LogError("Program.Main", ex, "Application startup failed");
throw;
}
finally
Expand Down Expand Up @@ -83,15 +75,7 @@ private static bool OnStartup(string[]? Args)
}
catch (Exception ex)
{
try
{
var logPath = Path.Combine(Path.GetDirectoryName(System.Environment.ProcessPath) ?? ".", "wauncher_startup_error.log");
File.WriteAllText(logPath, $"{DateTime.Now:yyyy-MM-dd HH:mm:ss}\nOnStartup Error:\n{ex}");
}
catch
{
}

ErrorLogger.LogError("Program.OnStartup", ex, "Startup validation failed");
return true; // Allow app to continue anyway
}
}
Expand Down Expand Up @@ -136,8 +120,9 @@ private static bool IsHardwareAccelerationDisabled()
return string.Equals(value, "true", StringComparison.OrdinalIgnoreCase);
}
}
catch
catch (Exception ex)
{
ErrorLogger.LogError("Program.IsHardwareAccelerationDisabled", ex, "Failed to check hardware acceleration setting");
}

return false;
Expand Down
13 changes: 8 additions & 5 deletions Wauncher/Services/CarouselService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ public async Task SetupCarouselAsync()

return urls.Count == 0 ? null : urls;
}
catch
{
return null;
catch (Exception ex)
{
ErrorLogger.LogError("CarouselService.LoadCarouselUrlsFromGitHubAsync", ex, "Failed to load carousel URLs from GitHub");
return null;
}
}

Expand All @@ -95,8 +96,9 @@ private static int GetCarouselSortIndex(string name)

return await File.ReadAllBytesAsync(path);
}
catch
catch (Exception ex)
{
ErrorLogger.LogError("CarouselService.TryGetCachedCarouselBytesAsync", ex, $"Failed to get cached carousel bytes for URL: {url}");
return null;
}
}
Expand All @@ -111,8 +113,9 @@ private static async Task TryWriteCarouselCacheAsync(string url, byte[] bytes)
await File.WriteAllBytesAsync(tempPath, bytes);
File.Move(tempPath, path, overwrite: true);
}
catch
catch (Exception ex)
{
ErrorLogger.LogError("CarouselService.TryWriteCarouselCacheAsync", ex, $"Failed to write carousel cache for URL: {url}");
// Best-effort cache only.
}
}
Expand Down
36 changes: 32 additions & 4 deletions Wauncher/Services/DiscordService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,59 @@ public async Task InitializeAsync()
{
await Task.Run(() =>
{
Discord.Init();
try
{
Discord.Init();
}
catch
{
// Discord integration is optional.
}
});
}

public async Task SetDetailsAsync(string details)
{
await Task.Run(() =>
{
Discord.SetDetails(details);
try
{
Discord.SetDetails(details);
}
catch
{
// Discord integration is optional.
}
});
}

public async Task UpdateAsync()
{
await Task.Run(() =>
{
Discord.Update();
try
{
Discord.Update();
}
catch
{
// Discord integration is optional.
}
});
}

public async Task ShutdownAsync()
{
await Task.Run(() =>
{
Discord.Deinitialize();
try
{
Discord.Deinitialize();
}
catch
{
// Discord integration is optional.
}
});
}
}
Expand Down
9 changes: 6 additions & 3 deletions Wauncher/Services/FriendsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,9 @@ public async Task LoadSelfProfileAsync()
CurrentUserUsername = self.Username;
});
}
catch
catch (Exception ex)
{
ErrorLogger.LogError("FriendsService.LoadSelfProfileAsync", ex, "Failed to load self profile");
// Best-effort profile load; keep defaults on failure.
}
}
Expand Down Expand Up @@ -206,8 +207,9 @@ public async Task RefreshFriendsAsync()
{
rawFriendsJson = await Api.Eddies.GetFriends(Steam.recentSteamID64 ?? string.Empty);
}
catch
catch (Exception ex)
{
ErrorLogger.LogError("FriendsService.RefreshFriendsAsync.GetFriends", ex, "Failed to get friends via SteamID64, trying SteamID2 fallback");
rawFriendsJson = await Api.Eddies.GetFriendsBySteamId2(Steam.recentSteamID2 ?? string.Empty);
}
var apiFriends = Api.ParseFriendsPayload(rawFriendsJson)
Expand Down Expand Up @@ -239,8 +241,9 @@ public async Task RefreshFriendsAsync()
FriendsStatus = Friends.Count == 0 ? "No friends found." : "";
});
}
catch
catch (Exception ex)
{
ErrorLogger.LogError("FriendsService.RefreshFriendsAsync", ex, "Failed to refresh friends");
if (TryShowCachedFriends(Steam.recentSteamID2 ?? string.Empty, forceOfflineStatus: true))
return;

Expand Down
26 changes: 23 additions & 3 deletions Wauncher/Services/GameService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,31 @@ public async Task<bool> LaunchAsync(string? connectTarget = null, string? launch
QueueDeferredConnect(resolvedTarget);
}

return await Task.Run(() => Game.Launch());
return await Task.Run(() =>
{
try
{
return Game.Launch();
}
catch (Exception ex)
{
ErrorLogger.LogError("GameService.LaunchAsync", ex, $"Connect target: {connectTarget}, Launch options: {launchOptions}");
throw;
}
});
}

public async Task MonitorAsync()
{
await Game.Monitor();
try
{
await Game.Monitor();
}
catch (Exception ex)
{
ErrorLogger.LogError("GameService.MonitorAsync", ex, "Game monitoring failed");
throw;
}
}

public bool IsRunning()
Expand Down Expand Up @@ -106,8 +125,9 @@ private static async Task<string> ResolveConnectTarget(string ipPort)
var address = addresses.FirstOrDefault();
return address == null ? ipPort.Trim() : $"{address}:{parts[1]}";
}
catch
catch (Exception ex)
{
ErrorLogger.LogError("GameService.ResolveConnectTarget", ex, $"Failed to resolve connect target: {ipPort}");
return ipPort.Trim();
}
}
Expand Down
10 changes: 9 additions & 1 deletion Wauncher/Services/UpdateService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
[ObservableProperty]
private bool _updateIndeterminate;

private CancellationTokenSource? _updateCts;

Check warning on line 46 in Wauncher/Services/UpdateService.cs

View workflow job for this annotation

GitHub Actions / build

The field 'UpdateService._updateCts' is never used

Check warning on line 46 in Wauncher/Services/UpdateService.cs

View workflow job for this annotation

GitHub Actions / build

The field 'UpdateService._updateCts' is never used
private Patches? _cachedPatches;
private bool _forceValidateAllOnce;

Expand Down Expand Up @@ -73,6 +73,11 @@

return needsUpdate;
}
catch (Exception ex)
{
ErrorLogger.LogError("UpdateService.CheckForUpdatesAsync", ex, "Failed to check for updates");
return false;
}
finally
{
IsCheckingUpdates = false;
Expand Down Expand Up @@ -139,6 +144,7 @@
}
catch (Exception ex)
{
ErrorLogger.LogError("UpdateService.InstallGameFromCdnAsync", ex, "Failed to install game from CDN");
DownloadManager.Cleanup7zFiles();
UpdateStatusFile = $"Install error: {ex.Message}";
UpdateStatusSpeed = "";
Expand Down Expand Up @@ -228,6 +234,7 @@
}
catch (Exception ex)
{
ErrorLogger.LogError("UpdateService.ValidateGameFilesAsync", ex, "Failed to validate game files");
UpdateStatusFile = $"Error: {ex.Message}";
UpdateStatusSpeed = "";
return false;
Expand All @@ -249,8 +256,9 @@
_cachedPatches = patches;
return patches;
}
catch
catch (Exception ex)
{
ErrorLogger.LogError("UpdateService.GetPatchesAsync", ex, "Failed to get patches");
return null;
}
}
Expand Down
Loading
Loading