Skip to content

Commit

Permalink
Store error at output-level when using NestedMultiOutput #328
Browse files Browse the repository at this point in the history
NestedMultiOutput now stores errors in the command output and not inside the output content to propagate errors correctly.
  • Loading branch information
jongyeol authored and mp911de committed Aug 11, 2016
1 parent 41c7727 commit 99a6cb0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Expand Up @@ -8,7 +8,6 @@
import java.util.LinkedList;
import java.util.List;

import com.lambdaworks.redis.RedisCommandExecutionException;
import com.lambdaworks.redis.codec.RedisCodec;
import com.lambdaworks.redis.protocol.CommandOutput;

Expand Down Expand Up @@ -39,11 +38,6 @@ public void set(ByteBuffer bytes) {
output.add(bytes == null ? null : codec.decodeValue(bytes));
}

@Override
public void setError(ByteBuffer error) {
output.add(new RedisCommandExecutionException(decodeAscii(error)));
}

@Override
public void complete(int depth) {
if (depth > 0 && depth < this.depth) {
Expand Down
Expand Up @@ -129,7 +129,7 @@ public String get() throws RedisException {
public void nestedMultiError() throws Exception {
NestedMultiOutput<String, String> output = new NestedMultiOutput<String, String>(codec);
output.setError(buffer("Oops!"));
assertThat(output.get().get(0) instanceof RedisException).isTrue();
assertThat(output.getError()).isNotNull();
}

@Test
Expand Down
8 changes: 8 additions & 0 deletions src/test/java/com/lambdaworks/redis/ScriptingCommandTest.java
Expand Up @@ -64,6 +64,14 @@ public void evalsha() throws Exception {
redis.evalsha(redis.digest("return 1 + 1 == 4"), INTEGER);
}

@Test
public void evalshaWithMulti() throws Exception {
redis.scriptFlush();
String digest = redis.digest("return {1234, 5678}");
exception.expectMessage("NOSCRIPT No matching script. Please use EVAL.");
redis.evalsha(digest, MULTI);
}

@Test
public void evalshaWithKeys() throws Exception {
redis.scriptFlush();
Expand Down

0 comments on commit 99a6cb0

Please sign in to comment.