refactor: merge TaskRunner failure handlers and reuse NullIfBlank
Unify the near-identical HandleFailure/MarkFailed into a single MarkFailed that always persists the failed state and never throws, and replace the inline null-if-blank checks in ListMcpTools with the existing extension. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
8
src/ClaudeDo.Worker/External/ListMcpTools.cs
vendored
8
src/ClaudeDo.Worker/External/ListMcpTools.cs
vendored
@@ -31,8 +31,8 @@ public sealed class ListMcpTools
|
||||
{
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
Name = name,
|
||||
WorkingDir = string.IsNullOrWhiteSpace(workingDir) ? null : workingDir,
|
||||
DefaultCommitType = string.IsNullOrWhiteSpace(commitType) ? CommitTypeRegistry.DefaultType : commitType,
|
||||
WorkingDir = workingDir.NullIfBlank(),
|
||||
DefaultCommitType = commitType.NullIfBlank() ?? CommitTypeRegistry.DefaultType,
|
||||
CreatedAt = DateTime.UtcNow,
|
||||
};
|
||||
await _lists.AddAsync(entity, cancellationToken);
|
||||
@@ -51,9 +51,9 @@ public sealed class ListMcpTools
|
||||
throw new InvalidOperationException("name cannot be blank.");
|
||||
if (name is not null) entity.Name = name;
|
||||
if (workingDir is not null)
|
||||
entity.WorkingDir = string.IsNullOrWhiteSpace(workingDir) ? null : workingDir;
|
||||
entity.WorkingDir = workingDir.NullIfBlank();
|
||||
if (commitType is not null)
|
||||
entity.DefaultCommitType = string.IsNullOrWhiteSpace(commitType) ? CommitTypeRegistry.DefaultType : commitType;
|
||||
entity.DefaultCommitType = commitType.NullIfBlank() ?? CommitTypeRegistry.DefaultType;
|
||||
|
||||
await _lists.UpdateAsync(entity, cancellationToken);
|
||||
await _broadcaster.ListUpdated(listId);
|
||||
|
||||
Reference in New Issue
Block a user