/** * If the passed item is in a failed state, automatically flag this workflow as having a failed activity * * @param WorkflowHistoryItem $item */ protected function flagActivityFailure(WorkflowHistoryItem $item) { switch ($item->getState()) { case HistoryItemState::FAILED(): case HistoryItemState::TIMED_OUT(): $this->setActivityFailed(); $this->error_messages[] = $item->getErrorMessage(); default: return; } }
public function apply(WorkflowHistory $history) { $reason = $this->getAttribute('timeoutType'); if ($details = $this->getAttribute('details', null)) { $reason .= ' (' . $details . ')'; } $item = $this->getHistoryItem($history, $this->getAttribute('scheduledEventId')); $item->setTimeEnded($this->timestamp); $item->setState(HistoryItemState::TIMED_OUT()); $item->setErrorMessage('(Timeout) ' . $reason); $history->add($item); }
/** * Check if this history item is a failure * * Includes failing, cancelling and timing out. * * @return bool */ public function isFailure() { switch ($this->state) { case HistoryItemState::CANCELLED(): case HistoryItemState::FAILED(): case HistoryItemState::TIMED_OUT(): return true; default: return false; } }