public function presentException(Exception $exception, $verbose = false)
{
$presentation = sprintf('Exception %s has been thrown.', $this->presentValue($exception));
if ($exception instanceof PHPSpec2Exception) {
$presentation = wordwrap($exception->getMessage(), 120);
}
if (!$verbose) {
return $presentation;
}
if ($exception instanceof NotEqualException) {
if ($diff = $this->presentExceptionDifference($exception)) {
return $presentation . "\n" . $diff;
}
}
if ($exception instanceof MockerException) {
return $exception->getMessage();
}
if ($exception instanceof PHPSpec2Exception) {
list($file, $line) = $this->getExceptionExamplePosition($exception);
return $presentation . "\n" . $this->presentFileCode($file, $line);
}
if (trim($trace = $this->presentExceptionStackTrace($exception))) {
return $presentation . "\n" . $trace;
}
return $presentation;
}