Search in sources :

Example 1 with io.vertx.up.exception._500UnexpectedRpcException

use of io.vertx.up.exception._500UnexpectedRpcException in project vertx-zero by silentbalanceyh.

the class RpcRepdor method reply.

public void reply(final Future<Envelop> handler, final AsyncResult<IpcResponse> response) {
    if (response.succeeded()) {
        handler.complete(DataEncap.out(response.result()));
    } else {
        final Throwable ex = response.cause();
        if (null != ex) {
            final Envelop envelop = Envelop.failure(new _500UnexpectedRpcException(this.clazz, ex));
            handler.complete(envelop);
            // TODO: Debug Now, Remove In Future
            ex.printStackTrace();
        }
    }
}
Also used : Envelop(io.vertx.up.atom.Envelop) io.vertx.up.exception._500UnexpectedRpcException(io.vertx.up.exception._500UnexpectedRpcException)

Example 2 with io.vertx.up.exception._500UnexpectedRpcException

use of io.vertx.up.exception._500UnexpectedRpcException in project vertx-zero by silentbalanceyh.

the class RpcRepdor method replyJson.

public void replyJson(final Future<JsonObject> handler, final AsyncResult<IpcResponse> response) {
    if (response.succeeded()) {
        final Envelop json = DataEncap.out(response.result());
        final JsonObject data = json.data();
        LOGGER.info(Info.CLIENT_RESPONSE, data);
        handler.complete(data);
    } else {
        final Throwable ex = response.cause();
        if (null != ex) {
            final Envelop envelop = Envelop.failure(new _500UnexpectedRpcException(this.clazz, ex));
            handler.complete(new JsonObject(envelop.response()));
            // TODO: Debug Now, Remove In Future
            ex.printStackTrace();
        }
    }
}
Also used : Envelop(io.vertx.up.atom.Envelop) JsonObject(io.vertx.core.json.JsonObject) io.vertx.up.exception._500UnexpectedRpcException(io.vertx.up.exception._500UnexpectedRpcException)

Aggregations

Envelop (io.vertx.up.atom.Envelop)2 io.vertx.up.exception._500UnexpectedRpcException (io.vertx.up.exception._500UnexpectedRpcException)2 JsonObject (io.vertx.core.json.JsonObject)1