code: void failActivityInstance(InternalEvent event,
              ProcessInstance processInst, Long activityId, Long activityInstId,
              BaseActivity activity, Throwable cause) throws DataAccessException, MdwException, SQLException {
  
          String tag = logtag(processInst.getProcessId(), processInst.getId(), activityId, activityInstId);
          logger.severeException("Failed to execute activity - " + cause.getClass().getName(), cause);
          String compCode = null;
          String statusMsg = buildStatusMessage(cause);
          try {
              ActivityInstance actInstVO = null;
              if (activity != null && activityInstId != null) {
                  activity.setReturnMessage(statusMsg);
                  actInstVO = edao.getActivityInstance(activityInstId);
                  failActivityInstance(actInstVO, statusMsg, processInst, tag, cause.getClass().getName());
                  compCode = activity.getReturnCode();
              }
              if (!AdapterActivity.COMPCODE_AUTO_RETRY.equals(compCode)) {
                  DocumentReference docRef = createActivityExceptionDocument(processInst, actInstVO, activity, cause);
                  InternalEvent outgoingMsg =
                      InternalEvent.createActivityErrorMessage(activityId, activityInstId, processInst.getId(), compCode,
                          event.getMasterRequestId(), statusMsg.length() > 2000 ? statusMsg.substring(0, 1999) : statusMsg, docRef.getDocumentId());
                  sendInternalEvent(outgoingMsg);
              }
          }
          catch (Exception ex) {
              logger.severeException("Exception thrown during failActivityInstance", ex);
              throw ex;
          }
      }
docs: Reports the error status of the activity instance to the activity manager