protected function _reportException($exception, $lineFlag = null)
{
$message = $exception['message'];
$isExpected = ($exp = end($this->_expected)) && ($exp === true || $exp === $message || Validator::isRegex($exp) && preg_match($exp, $message));
if ($isExpected) {
return array_pop($this->_expected);
}
$initFrame = current($exception['trace']) + array('class' => '-', 'function' => '-');
foreach ($exception['trace'] as $frame) {
if (isset($scopedFrame)) {
break;
}
if (!class_exists('lithium\\analysis\\Inspector')) {
continue;
}
if (isset($frame['class']) && in_array($frame['class'], Inspector::parents($this))) {
$scopedFrame = $frame;
}
}
if (class_exists('lithium\\analysis\\Debugger')) {
$exception['trace'] = Debugger::trace(array('trace' => $exception['trace'], 'format' => '{:functionRef}, line {:line}', 'includeScope' => false, 'scope' => array_filter(array('functionRef' => __NAMESPACE__ . '\\{closure}', 'line' => $lineFlag))));
}
$this->_result('exception', $exception + array('class' => $initFrame['class'], 'method' => $initFrame['function']));
}