code: public void failed(String errorMessage, String errorDetails, int retries, long retryDuration) {
      ensureActive();
  
      this.setErrorMessage(errorMessage);
      if (errorDetails != null) {
        setErrorDetails(errorDetails);
      }
      this.lockExpirationTime = new Date(ClockUtil.getCurrentTime().getTime() + retryDuration);
      setRetriesAndManageIncidents(retries);
      produceHistoricExternalTaskFailedEvent();
    }
docs: process failed state, make sure that binary entity is created for the errorMessage, shortError
  message does not exceed limit, handle properly retry counts and incidents
  
  @param errorMessage - short error message text
  @param errorDetails - full error details
  @param retries - updated value of retries left
  @param retryDuration - used for lockExpirationTime calculation