Skip to content

Commit 6631296

Browse files
committed
Handle download exceptions gracefully in NativeRuntimeUpdater
Made-with: Cursor
1 parent f5569be commit 6631296

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/LiveLingo.Core/Processing/NativeRuntimeUpdater.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,16 @@ public class NativeRuntimeUpdater(
8787
Directory.CreateDirectory(nativeDir);
8888

8989
var archivePath = Path.Combine(nativeDir, $"temp.{ext}");
90-
var bytes = await http.GetByteArrayAsync(downloadUrl, ct);
91-
await File.WriteAllBytesAsync(archivePath, bytes, ct);
90+
try
91+
{
92+
var bytes = await http.GetByteArrayAsync(downloadUrl, ct);
93+
await File.WriteAllBytesAsync(archivePath, bytes, ct);
94+
}
95+
catch (Exception ex) when (ex is HttpRequestException or IOException or TaskCanceledException)
96+
{
97+
logger.LogWarning(ex, "Failed to download llama-server from {Url}", downloadUrl);
98+
return null;
99+
}
92100

93101
if (ext == "zip")
94102
{

0 commit comments

Comments
 (0)