From 6d26bf2a9594cdf995b8c9a844bc526a8711e91b Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sun, 18 Feb 2018 14:20:33 +0000 Subject: [PATCH] Return the MadelineProto version along with exception traces --- src/danog/MadelineProto/Exception.php | 2 +- src/danog/MadelineProto/RPCErrorException.php | 2 +- src/danog/MadelineProto/TL/Exception.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/danog/MadelineProto/Exception.php b/src/danog/MadelineProto/Exception.php index f7779b43..85b43a48 100644 --- a/src/danog/MadelineProto/Exception.php +++ b/src/danog/MadelineProto/Exception.php @@ -19,7 +19,7 @@ class Exception extends \Exception public function __toString() { - return $this->file === 'MadelineProto' ? $this->message : '\danog\MadelineProto\Exception'.($this->message !== '' ? ': ' : '').$this->message.' in '.$this->file.':'.$this->line.PHP_EOL.'TL Trace (YOU ABSOLUTELY MUST READ THE TEXT BELOW):'.PHP_EOL.$this->getTLTrace(); + return $this->file === 'MadelineProto' ? $this->message : '\danog\MadelineProto\Exception'.($this->message !== '' ? ': ' : '').$this->message.' in '.$this->file.':'.$this->line.PHP_EOL.'Revision: '.@file_get_contents(__DIR__.'/../../../.git/refs/heads/master').PHP_EOL.'TL Trace (YOU ABSOLUTELY MUST READ THE TEXT BELOW):'.PHP_EOL.$this->getTLTrace(); } public function __construct($message = null, $code = 0, self $previous = null, $file = null, $line = null) diff --git a/src/danog/MadelineProto/RPCErrorException.php b/src/danog/MadelineProto/RPCErrorException.php index 82a8bb4f..a5c93809 100644 --- a/src/danog/MadelineProto/RPCErrorException.php +++ b/src/danog/MadelineProto/RPCErrorException.php @@ -32,7 +32,7 @@ class RPCErrorException extends \Exception public function __toString() { - return sprintf(\danog\MadelineProto\Lang::$current_lang['rpc_tg_error'], $this->getMess(), $this->rpc, $this->file, $this->line.PHP_EOL.PHP_EOL).PHP_EOL.$this->getTLTrace().PHP_EOL; + return sprintf(\danog\MadelineProto\Lang::$current_lang['rpc_tg_error'], $this->getMess(), $this->rpc, $this->file, $this->line.PHP_EOL.PHP_EOL).PHP_EOL.'Revision: '.@file_get_contents(__DIR__.'/../../../.git/refs/heads/master').PHP_EOL.$this->getTLTrace().PHP_EOL; } public function __construct($message = null, $code = 0, Exception $previous = null) diff --git a/src/danog/MadelineProto/TL/Exception.php b/src/danog/MadelineProto/TL/Exception.php index dfad843c..a6158c84 100644 --- a/src/danog/MadelineProto/TL/Exception.php +++ b/src/danog/MadelineProto/TL/Exception.php @@ -18,7 +18,7 @@ class Exception extends \Exception public function __toString() { - return get_class($this).($this->message !== '' ? ': ' : '').$this->message.PHP_EOL.'TL Trace (YOU ABSOLUTELY MUST READ THE TEXT BELOW):'.PHP_EOL.PHP_EOL.$this->getTLTrace().PHP_EOL; + return get_class($this).($this->message !== '' ? ': ' : '').$this->message.PHP_EOL.@file_get_contents(__DIR__.'/../../../.git/refs/heads/master').PHP_EOL.'TL Trace (YOU ABSOLUTELY MUST READ THE TEXT BELOW):'.PHP_EOL.PHP_EOL.$this->getTLTrace().PHP_EOL; } public function __construct($message, $file = '')