简体   繁体   中英

vert-x 3.3.2 http client exception handler

Am using Vert-x 3.3.2.

HttpClient.exceptionHandler and HttpClientRequest.exceptionHandler is throwing compilation error.

Whether exception handler is removed for this classes.

Any other way to handle this.

    var client = vertx.createHttpClient(options);
    var request = client.getNow(8080, "localhost", data, function (resp)  {

            resp.bodyHandler(function (body) {
                console.log(body.toString());
            });
            resp.exceptionHandler(function(err){
                console.log("Response Exception:::"+err.getCode());
            });

    });
    request.exceptionHandler(function(Err){
        console.log("Client Exception ::: "+Err);
    });

Also tried

    client.exceptionHandler(function(Err){
        console.log("Client Exception ::: "+Err);
    });

Could anyone help on this.

You're using getNow() method. xxxNow() methods don't receive exceptionHandler: http://vertx.io/docs/vertx-core/js/#_making_requests

IMPORTANT XXXNow methods cannot receive an exception handler.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM