Skip to content

Commit 99cadec

Browse files
committed
report interactive album search fails
1 parent 21338ce commit 99cadec

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

slsk-batchdl.Cli/Services/InteractiveCliCoordinator.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,11 @@ private async Task HandleCompletedSearchAsync(Guid searchJobId, CancellationToke
135135
ct);
136136
var folders = projection?.Items.Select(ToAlbumFolder).ToList() ?? [];
137137
if (folders.Count == 0)
138+
{
139+
if (ConsoleInputManager.Reporter != null)
140+
ConsoleInputManager.Reporter.ReportSyntheticJobFailure(detail.Summary.DisplayId, "AlbumJob", search.QueryText, "No suitable file found");
138141
return;
142+
}
139143

140144
var promptJob = ToSearchJob(search);
141145
var session = new InteractiveAlbumSession(

slsk-batchdl.Cli/Utilities/CliProgressReporter.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,21 @@ public void Stop()
8383
_live?.Dispose();
8484
}
8585

86+
public void ReportSyntheticJobFailure(int displayId, string jobType, string name, string failureReason)
87+
{
88+
string msg = $"failed [{failureReason}]: {name}";
89+
90+
if (LiveMode)
91+
{
92+
_live!.Log(new TerminalLogLine(TerminalLogKind.JobFailed, Guid.Empty.ToString(), displayId, jobType, msg));
93+
Logger.LogNonConsole(Logger.LogLevel.Info, $"[{displayId:000}] {jobType}: {msg}");
94+
}
95+
else
96+
{
97+
Logger.Info($"[{displayId:000}] {jobType}: {msg}");
98+
}
99+
}
100+
86101
internal void Attach(ICliBackend backend)
87102
{
88103
backend.EventReceived += envelope =>

0 commit comments

Comments
 (0)