code: public static MongoException fromThrowableNonNull(final Throwable t) {
        if (t instanceof MongoException) {
              return (MongoException) t;
          } else {
              return new MongoException(t.getMessage(), t);
          }
      }
docs: 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