Q:

Catch Exceptions when using Completable.blockingAwait()

I recently started using RxJava 2 and am wondering if its possible to catch more specific Exceptions when calling Completable.blockingAwait().
This is what I am doing:
try {

  Completable.create(new CompletableOnSubscribe() {
    @Override
    public void subscribe(@NonNull CompletableEmitter e) throws Exception {
        e.onError(new IOException());
    }
  }).blockingAwait();

} catch (RuntimeException e) {
  Throwable cause = e.getCause();

  if(cause instanceof IOException) {
      // Handle IOException
  }
}

And this is what I would like to do:
try {

  Completable.create(new CompletableOnSubscribe() {
    @Override
    public void subscribe(@NonNull CompletableEmitter e) throws Exception {
        e.onError(new IOException());
    }
  }).blockingAwait();

} catch (IOException e) {
  // Handle IOException
}

Is there any possibility to make this work?

A:

A couple of lines down in the linked Javadoc there is the blockingGet operator that returns a Throwable which you can do instanceof checks with:
 Throwable err = Completable.error(new IOException()).blockingGet();
 if (err instanceof IOException) {
     // ...
 }

