Commit 40f45cc8 authored by mgravell's avatar mgravell

include the origin of timeouts

parent 21c8bf36
...@@ -2152,7 +2152,7 @@ private static async Task<T> ExecuteAsyncImpl_Awaited<T>(ConnectionMultiplexer @ ...@@ -2152,7 +2152,7 @@ private static async Task<T> ExecuteAsyncImpl_Awaited<T>(ConnectionMultiplexer @
return tcs == null ? default(T) : await tcs.Task.ForAwait(); return tcs == null ? default(T) : await tcs.Task.ForAwait();
} }
internal Exception GetException(WriteResult result, Message message, ServerEndPoint server) internal Exception GetException(WriteResult result, Message message, ServerEndPoint server, [CallerMemberName] string caller = null)
{ {
switch (result) switch (result)
{ {
...@@ -2160,7 +2160,7 @@ internal Exception GetException(WriteResult result, Message message, ServerEndPo ...@@ -2160,7 +2160,7 @@ internal Exception GetException(WriteResult result, Message message, ServerEndPo
case WriteResult.NoConnectionAvailable: case WriteResult.NoConnectionAvailable:
return ExceptionFactory.NoConnectionAvailable(IncludeDetailInExceptions, IncludePerformanceCountersInExceptions, message.Command, message, server, GetServerSnapshot()); return ExceptionFactory.NoConnectionAvailable(IncludeDetailInExceptions, IncludePerformanceCountersInExceptions, message.Command, message, server, GetServerSnapshot());
case WriteResult.TimeoutBeforeWrite: case WriteResult.TimeoutBeforeWrite:
return ExceptionFactory.Timeout(this, "The timeout was reached before the message could be written to the output buffer, and it was not sent", message, server, result); return ExceptionFactory.Timeout(this, "The timeout was reached before the message could be written to the output buffer, and it was not sent", message, server, result, caller: caller);
case WriteResult.WriteFailure: case WriteResult.WriteFailure:
default: default:
return ExceptionFactory.ConnectionFailure(IncludeDetailInExceptions, ConnectionFailureType.ProtocolFailure, "An unknown error occurred when writing the message", server); return ExceptionFactory.ConnectionFailure(IncludeDetailInExceptions, ConnectionFailureType.ProtocolFailure, "An unknown error occurred when writing the message", server);
......
...@@ -181,7 +181,7 @@ internal static string GetLibVersion() ...@@ -181,7 +181,7 @@ internal static string GetLibVersion()
} }
return _libVersion; return _libVersion;
} }
internal static Exception Timeout(ConnectionMultiplexer mutiplexer, string baseErrorMessage, Message message, ServerEndPoint server, WriteResult? result = null) internal static Exception Timeout(ConnectionMultiplexer mutiplexer, string baseErrorMessage, Message message, ServerEndPoint server, WriteResult? result = null, string origin = null)
{ {
List<Tuple<string, string>> data = new List<Tuple<string, string>> { Tuple.Create("Message", message.CommandAndKey) }; List<Tuple<string, string>> data = new List<Tuple<string, string>> { Tuple.Create("Message", message.CommandAndKey) };
var sb = new StringBuilder(); var sb = new StringBuilder();
...@@ -198,11 +198,13 @@ void add(string lk, string sk, string v) ...@@ -198,11 +198,13 @@ void add(string lk, string sk, string v)
{ {
if (v != null) if (v != null)
{ {
data.Add(Tuple.Create(lk, v)); if (lk != null) data.Add(Tuple.Create(lk, v));
sb.Append(", ").Append(sk).Append(": ").Append(v); if (sk != null) sb.Append(", ").Append(sk).Append(": ").Append(v);
} }
} }
if (!string.IsNullOrWhiteSpace(origin)) add("Origin", null, origin);
// Add timeout data, if we have it // Add timeout data, if we have it
if (result == WriteResult.TimeoutBeforeWrite) if (result == WriteResult.TimeoutBeforeWrite)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment