Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/Stackify/Log/Entities/ErrorWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class ErrorWrapper
private $sourceMethod;

const TYPE_STRING_EXCEPTION = 'StringException';
const UNKNOWN_METHOD = '{unknown}';

/**
* @var \Stackify\Log\Entities\ErrorWrapper
Expand All @@ -24,7 +25,12 @@ public function __construct($object, $nestingLevel = 1)
$this->message = $object->getMessage();
$this->type = get_class($object);
$this->code = $object->getCode();
$this->setTrace($object->getTrace());
$trace = $object->getTrace();
$trace[] = array(
'file' => $object->getFile(),
'line' => $object->getLine(),
);
$this->setTrace($trace);
$previous = $object->getPrevious();
if (null !== $previous) {
// limit nesting level if needed here
Expand Down Expand Up @@ -80,7 +86,11 @@ private function setTrace(array $trace)
{
$result = array();
foreach ($this->filterTrace($trace) as $index => $item) {
$function = $item['function'] . '()';
if (isset($item['function'])) {
$function = $item['function'] . '()';
} else {
$function = self::UNKNOWN_METHOD;
}
if (isset($item['class'])) {
// type is -> or :: which means dynamic or static method call
$type = isset($item['type']) ? $item['type'] : '->';
Expand Down
2 changes: 0 additions & 2 deletions src/Stackify/Log/Entities/NativeError.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ public function getTrace()
$traceItem = array(
'file' => $this->file,
'line' => $this->line,
// "method" is not defined in native error
'function' => '{unknown}',
);
return array($traceItem);
}
Expand Down