How to catch a decryption failed exception?


I am encrypting the realm database. I am wondering how to do something if the encryption fails when trying to open the database. Below is my code. When it does fail, it doesn’t crash when I have the catch in, but nothing gets called in the catch statement.

RealmConfiguration config = new RealmConfiguration.Builder()
                .modules(new RealmDefaultModule())

        try (Realm realm = Realm.getDefaultInstance()) {
            Timber.e("Realm tries opening");
        }catch (Exception e){
            //Delete Realm if fail to open
//            Realm.deleteRealm(config);
            Timber.e("Realm decryption failed. This does not get called");


This seems to be working, just Timber is not showing up in Logcat. If there is a better way I should be handling this, let me know.