How to capture error while using CouchbaseAsyncCluster.openBucket call

I have the following code that creates Couchbase cluster and tried to open a bucket. The name given to the bucket is a wrong name. I want to capture the error since the bucket does not exist. Using java client version 2.7.6 and Java 11.

CouchbaseAsyncCluster cluster = 
cluster.authenticate("Administrator", "password");
rx.Observable<AsyncBucket> bucket;
        .doOnError(e -> System.out.println("error occurred"))
        .doOnNext(openbucket -> System.out.println("bucket opened"))
        .subscribe(openBucket -> System.out.println("subscription 

The above code does not generate any error and no entry in log either. What is the best way to capture the error opening a bucket?

This question was also posted on Stack Overflow, and answered there: