package io.vertx.redis.impl;

import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;
import io.vertx.redis.RedisEncoding;

/**
 * @author <a href="mailto:marko.strukelj@gmail.com">Marko Strukelj</a>
 */
public class DumpHandler implements Handler<AsyncResult<String>> {

  private Handler<AsyncResult<String>> delegate;

  public DumpHandler(Handler<AsyncResult<String>> handler) {
    this.delegate = handler;
  }

  @Override
  public void handle(AsyncResult<String> event) {
    delegate.handle(new DelegatingAsyncResult(event));
  }

  private static class DelegatingAsyncResult implements AsyncResult<String> {

    private AsyncResult<String> delegate;

    private DelegatingAsyncResult(AsyncResult<String> event) {
      this.delegate = event;
    }

    @Override
    public String result() {
      String result = delegate.result();
      if (result == null) {
        return null;
      }
      return RedisEncoding.encode(result);
    }

    @Override
    public Throwable cause() {
      return delegate.cause();
    }

    @Override
    public boolean succeeded() {
      return delegate.succeeded();
    }

    @Override
    public boolean failed() {
      return delegate.failed();
    }
  }
}

@@ -656,24 +656,51 @@
 g%3E delegate;
+%0A    private Throwable err;
 %0A%0A    privat
@@ -929,16 +929,30 @@
       %7D%0A
+      try %7B%0A  
       re
@@ -986,16 +986,92 @@
 esult);%0A
+      %7D catch (Throwable th) %7B%0A        err = th;%0A      %7D%0A      return null;%0A
     %7D%0A%0A 
@@ -1118,32 +1118,52 @@
 ) %7B%0A      return
+ err != null ? err :
  delegate.cause(
@@ -1223,32 +1223,54 @@
 ) %7B%0A      return
+ err != null ? false :
  delegate.succee
@@ -1323,24 +1323,24 @@
  failed() %7B%0A
-
       return
@@ -1339,16 +1339,37 @@
   return
+ err != null ? true :
  delegat

Fix error reporting in DumpHandler