Skip to content

Commit 382f061

Browse files
committed
Fix MarkFailed to store FailureReason (self-review finding #1)
1 parent 53dd9d1 commit 382f061

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

backend/src/Taskdeck.Domain/Entities/IntentEnvelopeV1.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ public class IntentEnvelopeV1 : Entity
5353
/// </summary>
5454
public string? CorrelationId { get; private set; }
5555

56+
/// <summary>
57+
/// Reason for failure when status is <see cref="EnvelopeStatus.Failed"/>.
58+
/// Null when the envelope has not failed.
59+
/// </summary>
60+
public string? FailureReason { get; private set; }
61+
5662
private readonly List<SourceBlock> _sourceBlocks = new();
5763
public IReadOnlyList<SourceBlock> SourceBlocks => _sourceBlocks.AsReadOnly();
5864

@@ -160,6 +166,7 @@ public void MarkFailed(string? reason = null)
160166
"Cannot mark an already-processed envelope as failed");
161167

162168
Status = EnvelopeStatus.Failed;
169+
FailureReason = string.IsNullOrWhiteSpace(reason) ? null : reason.Trim();
163170
Touch();
164171
}
165172
}

0 commit comments

Comments
 (0)