DataSift\Storyplayer\PlayerLib\Phase_Result::getException PHP Method

getException() public method

public getException ( ) : Exception | null
return Exception | null
    public function getException()
    {
        return $this->exception;
    }

Usage Example

Beispiel #1
0
 /**
  * @param Phase_Result $phaseResult
  */
 protected function showActivityForPhase(Story $story, Phase_Result $phaseResult)
 {
     // what is the phase that we are dealing with?
     $phaseName = $phaseResult->getPhaseName();
     $activityLog = $phaseResult->activityLog;
     // our final messages to show the user
     $codePoints = [];
     $trace = null;
     // does the phase have an exception?
     $e = $phaseResult->getException();
     if ($e) {
         $stackTrace = $e->getTrace();
         $trace = $e->getTraceAsString();
     }
     // let's tell the user what we found
     $this->write("=============================================================" . PHP_EOL, $this->writer->commentStyle);
     $this->write("DETAILED ERROR REPORT" . PHP_EOL);
     $this->write("----------------------------------------" . PHP_EOL . PHP_EOL, $this->writer->commentStyle);
     $this->write("The story failed in the ");
     $this->write($phaseName, $this->writer->failedPhaseStyle);
     $this->write(" phase." . PHP_EOL);
     if (!empty($activityLog)) {
         $this->write(PHP_EOL . "-----" . PHP_EOL, $this->writer->commentStyle);
         $this->write("This is the detailed output from the ");
         $this->write($phaseName, $this->writer->failedPhaseStyle);
         $this->write(" phase:" . PHP_EOL . PHP_EOL);
         foreach ($activityLog as $msg) {
             $this->writeActivity($msg['text'], $msg['codeLine'], $msg['ts']);
         }
     }
     if ($trace !== null) {
         $this->write(PHP_EOL . "-----" . PHP_EOL, $this->writer->commentStyle);
         $this->write("This is the stack trace for this failure:" . PHP_EOL . PHP_EOL . CodeFormatter::indentBySpaces($trace, 4) . PHP_EOL . PHP_EOL);
     }
     // all done
     $this->write("----------------------------------------" . PHP_EOL, $this->writer->commentStyle);
     $this->write("END OF ERROR REPORT" . PHP_EOL);
     $this->write("=============================================================" . PHP_EOL . PHP_EOL, $this->writer->commentStyle);
 }