code: public static Fault naturalize(Throwable ex) {
          while (ex instanceof InvocationTargetException || ex instanceof UndeclaredThrowableException) {
              ex = ex.getCause();
          }
          if (ex instanceof Fault) {
              return Fault.class.cast(ex);
          }
          return Fault.create(FaultCode.create(ex.getClass()), ex, ex.getMessage());
      }
docs: Convert a <code>Throwable (Error/Exception/RuntimeException)</code> other than <code>Fault</code> into a
  <code>Fault</code>. This function unwraps the <code>Throwable</code> if it is an
  <code>InvocationTargetException</code> or <code>UndeclaredThrowableException</code>.
  
  It uses the full class name of the throwable as the fault code with a message template of <code>'{0}'</code>,
  i.e. just one place holder. The original exception is the cause of the returned Fault. The message of the
  original exception is used to populate the place holder. Please refer to <code>JreFaultCode</code> for the
  FaultCodes of all JRE <code>Exceptions/Errors</code>.
  
  @param ex
  the exception to be naturalized
  @return Fault