driver-core/src/main/com/mongodb/MongoException.java
public static MongoException fromThrowableNonNull(final Throwable t) {
      if (t instanceof MongoException) {
            return (MongoException) t;
        } else {
            return new MongoException(t.getMessage(), t);
        }
    }
public static MongoException fromThrowableNonNull(final Throwable t) {
      if (t instanceof MongoException) {
            return (MongoException) t;
        } else {
            return new MongoException(t.getMessage(), t);
        }
    }
public static MongoException fromThrowableNonNull ( final Throwable t ) { if ( t instanceof MongoException ) { return ( MongoException ) t ; } else { return new MongoException ( t . getMessage ( ) , t ) ; } }
Static helper to create or cast a MongoException from a throwable

@param t a throwable, which may not be null
@return a MongoException
@since 3.7
Static helper to create or cast a MongoException from a throwable