improv da tl trace

This commit is contained in:
Daniil Gentili 2017-07-26 10:56:55 +02:00
parent 2e92a8ed20
commit 62af29c1c9

View File

@ -24,7 +24,7 @@ trait PrettyException
public function prettify_tl($init = '')
{
$tl = false;
foreach (array_reverse($this->getTrace()) as $frame) {
foreach (array_reverse($this->getTrace()) as $k => $frame) {
if (isset($frame['function']) && in_array($frame['function'], ['serialize_params', 'serialize_object'])) {
if ($frame['args'][2] !== '') {
$this->tl_trace .= $tl ? "['".$frame['args'][2]."']" : "While serializing: \t".$frame['args'][2];
@ -34,6 +34,7 @@ trait PrettyException
if ($tl) {
$this->tl_trace .= PHP_EOL;
}
if (isset($frame['function']) && $frame['function'] === 'handle_rpc_error' && $k === count($this->getTrace())-1) continue;
$this->tl_trace .= isset($frame['file']) ? str_pad(basename($frame['file']).'('.$frame['line'].'):', 16)."\t" : '';
$this->tl_trace .= isset($frame['function']) ? $frame['function'].'(' : '';
$this->tl_trace .= isset($frame['args']) ? substr(json_encode($frame['args']), 1, -1) : '';