Skip to content

Commit f77b9a6

Browse files
committed
Some event do not carry timings information but DebugInformation still tries to display timings information (#3783)
(cherry picked from commit 0fca6d0)
1 parent 1062956 commit f77b9a6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Elasticsearch.Net/Responses/ResponseStatics.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static void DebugAuditTrailExceptions(List<Audit> auditTrail, System.Text
4242
sb.AppendLine($"# Audit exception in step {a.i + 1} {a.audit.Event.GetStringValue()}:\r\n{a.audit.Exception}");
4343
}
4444

45-
public static void DebugAuditTrail(List<Audit> auditTrail, System.Text.StringBuilder sb)
45+
public static void DebugAuditTrail(List<Audit> auditTrail, StringBuilder sb)
4646
{
4747
if (auditTrail == null) return;
4848

@@ -54,7 +54,9 @@ public static void DebugAuditTrail(List<Audit> auditTrail, System.Text.StringBui
5454
AuditNodeUrl(sb, audit);
5555

5656
if (audit.Exception != null) sb.Append($" Exception: {audit.Exception.GetType().Name}");
57-
sb.AppendLine($" Took: {(audit.Ended - audit.Started).ToString()}");
57+
if (audit.Ended == default)
58+
sb.AppendLine();
59+
else sb.AppendLine($" Took: {(audit.Ended - audit.Started).ToString()}");
5860
}
5961
}
6062

0 commit comments

Comments
 (0)