code: private Throwable getCause(Throwable t) {
          Throwable cause = t.getCause();
          if (t.getCause() != null) {
              return cause;
          } else {
              return t;
          }
      }
docs: get if 'cause' exists, else return the original exception