From 62af29c1c95be720f85dd0c80ed238de672c8270 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Wed, 26 Jul 2017 10:56:55 +0200 Subject: [PATCH] improv da tl trace --- src/danog/MadelineProto/TL/PrettyException.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/danog/MadelineProto/TL/PrettyException.php b/src/danog/MadelineProto/TL/PrettyException.php index f658b181e..f2b5c1094 100644 --- a/src/danog/MadelineProto/TL/PrettyException.php +++ b/src/danog/MadelineProto/TL/PrettyException.php @@ -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) : '';