1
0
Fork 0

Update logger to better handle errors

pull/357/head
Sara Itani 2017-04-16 15:09:05 -07:00
parent 6d39d87278
commit 4382821b8c
1 changed files with 7 additions and 3 deletions

View File

@ -15,7 +15,7 @@ use Microsoft\PhpParser as Tolerant;
trait LoggedDefinitionResolverTrait trait LoggedDefinitionResolverTrait
{ {
private static $logger = false; private static $logger = true;
private static $stackLevel = 0; private static $stackLevel = 0;
@ -27,7 +27,7 @@ trait LoggedDefinitionResolverTrait
public function __construct(ReadableIndex $index) public function __construct(ReadableIndex $index)
{ {
parent::__construct($index); parent::__construct($index);
self::$logger = false; self::$logger = true;
self::$maxRecursion = 0; self::$maxRecursion = 0;
} }
@ -80,7 +80,11 @@ trait LoggedDefinitionResolverTrait
} elseif ($result instanceof DocBlock) { } elseif ($result instanceof DocBlock) {
$resultText = $result->getDescription(); $resultText = $result->getDescription();
} else { } else {
$resultText = $result ?? "NULL"; try {
$resultText = (string) $result;
} catch (\Throwable $e) {
$resultText = "UNKNOWN";
}
} }
echo str_repeat("\t", self::$recursion + 1) . "> RESULT[$callStr]: " . $resultText . "\n"; echo str_repeat("\t", self::$recursion + 1) . "> RESULT[$callStr]: " . $resultText . "\n";
} }