Skip to content

Commit

Permalink
Align exceptions when invoking commands #119
Browse files Browse the repository at this point in the history
Throw RedisException instead of future-transport on disconnected state when reconnect is disabled.
  • Loading branch information
mp911de committed Aug 19, 2015
1 parent c7999ea commit 40e7184
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,8 @@ public <T, C extends RedisCommand<K, V, T>> C write(C command) {
}

if ((channel == null || !isConnected()) && !clientOptions.isAutoReconnect()) {
command.completeExceptionally(new RedisException(
"Connection is in a disconnected state and reconnect is disabled. Commands are not accepted."));
return command;
throw new RedisException(
"Connection is in a disconnected state and reconnect is disabled. Commands are not accepted.");
}

try {
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/lambdaworks/redis/ClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public void disconnectedConnectionWithoutReconnect() throws Exception {
connection.quit();
Wait.untilTrue(() -> !connection.isOpen()).waitOrTimeout();
try {
connection.get(key).get();
connection.get(key);
} catch (Exception e) {
assertThat(e).hasRootCauseInstanceOf(RedisException.class).hasMessageContaining(
"Connection is in a disconnected state and reconnect is disabled");
Expand Down

0 comments on commit 40e7184

Please sign in to comment.