fix(ui): surface merge-drain cancel rejection in task-row quick cancel

TasksIslandViewModel.CancelReviewAsync swallowed the HubException the
worker raises when a task's unit merge is draining (79f90a9), unlike
the details-pane version fixed in the same commit. Mirror that fix:
report the rejection via ErrorReported instead of a bare catch.
This commit is contained in:
mika kuns
2026-08-06 14:31:13 +02:00
parent bac8387069
commit 27d50b81ff
4 changed files with 27 additions and 3 deletions
@@ -63,4 +63,28 @@ public class TasksIslandApproveReviewTests : IDisposable
Assert.NotNull(reportedError);
Assert.Contains(worker.ExceptionMessage, reportedError);
}
private sealed class ThrowingCancelWorkerClient : StubWorkerClient
{
public string ExceptionMessage { get; init; } =
"A merge is in progress for this task; wait for it to finish before cancelling.";
public override Task CancelReviewAsync(string taskId) => throw new Exception(ExceptionMessage);
}
[Fact]
public async Task CancelReview_WhenWorkerThrows_RaisesErrorReported()
{
var worker = new ThrowingCancelWorkerClient();
var factory = new TestDbFactory(NewContext);
var vm = new TasksIslandViewModel(factory, worker);
string? reportedError = null;
vm.ErrorReported += msg => reportedError = msg;
var row = new TaskRowViewModel { Id = "task-cancel-err-2", Status = TaskStatus.WaitingForReview };
await vm.CancelReviewCommand.ExecuteAsync(row);
Assert.NotNull(reportedError);
Assert.Contains(worker.ExceptionMessage, reportedError);
}
}