Commit 20d6a7b6 authored by Marc Gravell's avatar Marc Gravell

Merge pull request #54 from deepakverma/master

Add innerexception message in case of a fault 
parents bb3b5e69 09fabdab
...@@ -662,7 +662,7 @@ public static async Task<ConnectionMultiplexer> ConnectAsync(string configuratio ...@@ -662,7 +662,7 @@ public static async Task<ConnectionMultiplexer> ConnectAsync(string configuratio
bool configured = await muxer.ReconfigureAsync(true, false, log, null, "connect").ObserveErrors().ForAwait(); bool configured = await muxer.ReconfigureAsync(true, false, log, null, "connect").ObserveErrors().ForAwait();
if (!configured) if (!configured)
{ {
throw ExceptionFactory.UnableToConnect(); throw ExceptionFactory.UnableToConnect(muxer.failureMessage);
} }
killMe = null; killMe = null;
return muxer; return muxer;
...@@ -685,7 +685,7 @@ public static async Task<ConnectionMultiplexer> ConnectAsync(ConfigurationOption ...@@ -685,7 +685,7 @@ public static async Task<ConnectionMultiplexer> ConnectAsync(ConfigurationOption
bool configured = await muxer.ReconfigureAsync(true, false, log, null, "connect").ObserveErrors().ForAwait(); bool configured = await muxer.ReconfigureAsync(true, false, log, null, "connect").ObserveErrors().ForAwait();
if (!configured) if (!configured)
{ {
throw ExceptionFactory.UnableToConnect(); throw ExceptionFactory.UnableToConnect(muxer.failureMessage);
} }
killMe = null; killMe = null;
return muxer; return muxer;
...@@ -733,7 +733,7 @@ public static ConnectionMultiplexer Connect(string configuration, TextWriter log ...@@ -733,7 +733,7 @@ public static ConnectionMultiplexer Connect(string configuration, TextWriter log
throw new TimeoutException(); throw new TimeoutException();
} }
} }
if(!task.Result) throw ExceptionFactory.UnableToConnect(); if(!task.Result) throw ExceptionFactory.UnableToConnect(muxer.failureMessage);
killMe = null; killMe = null;
return muxer; return muxer;
} }
...@@ -762,7 +762,7 @@ public static ConnectionMultiplexer Connect(ConfigurationOptions configuration, ...@@ -762,7 +762,7 @@ public static ConnectionMultiplexer Connect(ConfigurationOptions configuration,
throw new TimeoutException(); throw new TimeoutException();
} }
} }
if(!task.Result) throw ExceptionFactory.UnableToConnect(); if (!task.Result) throw ExceptionFactory.UnableToConnect(muxer.failureMessage);
killMe = null; killMe = null;
return muxer; return muxer;
} }
...@@ -772,6 +772,7 @@ public static ConnectionMultiplexer Connect(ConfigurationOptions configuration, ...@@ -772,6 +772,7 @@ public static ConnectionMultiplexer Connect(ConfigurationOptions configuration,
} }
} }
private string failureMessage;
private readonly Hashtable servers = new Hashtable(); private readonly Hashtable servers = new Hashtable();
private volatile ServerEndPoint[] serverSnapshot = NilServers; private volatile ServerEndPoint[] serverSnapshot = NilServers;
...@@ -1183,6 +1184,7 @@ internal async Task<bool> ReconfigureAsync(bool first, bool reconfigureAll, Text ...@@ -1183,6 +1184,7 @@ internal async Task<bool> ReconfigureAsync(bool first, bool reconfigureAll, Text
foreach (var ex in aex.InnerExceptions) foreach (var ex in aex.InnerExceptions)
{ {
LogLocked(log, "{0} faulted: {1}", Format.ToString(endpoints[i]), ex.Message); LogLocked(log, "{0} faulted: {1}", Format.ToString(endpoints[i]), ex.Message);
failureMessage = ex.Message;
} }
} }
else if (task.IsCanceled) else if (task.IsCanceled)
......
...@@ -106,10 +106,10 @@ static string GetLabel(bool includeDetail, RedisCommand command, Message message ...@@ -106,10 +106,10 @@ static string GetLabel(bool includeDetail, RedisCommand command, Message message
return message == null ? command.ToString() : (includeDetail ? message.CommandAndKey : message.Command.ToString()); return message == null ? command.ToString() : (includeDetail ? message.CommandAndKey : message.Command.ToString());
} }
internal static Exception UnableToConnect() internal static Exception UnableToConnect(string failureMessage=null)
{ {
return new RedisConnectionException(ConnectionFailureType.UnableToConnect, return new RedisConnectionException(ConnectionFailureType.UnableToConnect,
"It was not possible to connect to the redis server(s); to create a disconnected multiplexer, disable AbortOnConnectFail"); "It was not possible to connect to the redis server(s); to create a disconnected multiplexer, disable AbortOnConnectFail. " + failureMessage);
} }
} }
} }
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