code: public static KbException fromThrowable(Throwable cause) {
      return (cause instanceof KbException)
                     ? (KbException) cause
                     : new KbException(cause);
    }
docs: Converts a Throwable to a KbException. If the Throwable is a
  KbException, it will be passed through unmodified; otherwise, it will be wrapped
  in a new KbException.
  
  @param cause the Throwable to convert
  
  @return a KbException