fixes
This commit is contained in:
parent
a3e2744099
commit
6997826bf4
@ -14,13 +14,15 @@ namespace danog\MadelineProto;
|
|||||||
|
|
||||||
class Exception extends \Exception
|
class Exception extends \Exception
|
||||||
{
|
{
|
||||||
public function __construct($message = null, $code = 0, Exception $previous = null)
|
public function __construct($message = null, $code = 0, Exception $previous = null, $file = null, $line = null)
|
||||||
{
|
{
|
||||||
parent::__construct($message, $code, $previous);
|
parent::__construct($message, $code, $previous);
|
||||||
if (\danog\MadelineProto\Logger::$constructed && $this->file !== __FILE__) {
|
if (\danog\MadelineProto\Logger::$constructed && $this->file !== __FILE__) {
|
||||||
\danog\MadelineProto\Logger::log([$message.' in '.basename($this->file).':'.$this->line], \danog\MadelineProto\Logger::FATAL_ERROR);
|
\danog\MadelineProto\Logger::log([$message.' in '.basename($this->file).':'.$this->line], \danog\MadelineProto\Logger::FATAL_ERROR);
|
||||||
}
|
}
|
||||||
\Rollbar\Rollbar::report_exception($this);
|
if ($line !== null) $this->line = $line;
|
||||||
|
if ($file !== null) $this->file = $file;
|
||||||
|
\Rollbar\Rollbar::log($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,9 +39,7 @@ class Exception extends \Exception
|
|||||||
if (\danog\MadelineProto\Logger::$constructed) {
|
if (\danog\MadelineProto\Logger::$constructed) {
|
||||||
\danog\MadelineProto\Logger::log([$errstr.' in '.basename($errfile).':'.$errline], \danog\MadelineProto\Logger::FATAL_ERROR);
|
\danog\MadelineProto\Logger::log([$errstr.' in '.basename($errfile).':'.$errline], \danog\MadelineProto\Logger::FATAL_ERROR);
|
||||||
}
|
}
|
||||||
$e = new self($errstr, $errno);
|
$e = new self($errstr, $errno, null, $errfile, $errline);
|
||||||
$e->file = $errfile;
|
|
||||||
$e->line = $errline;
|
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ trait CallHandler
|
|||||||
if (!isset($aargs['datacenter'])) {
|
if (!isset($aargs['datacenter'])) {
|
||||||
throw new \danog\MadelineProto\Exception('No datacenter provided');
|
throw new \danog\MadelineProto\Exception('No datacenter provided');
|
||||||
}
|
}
|
||||||
if (isset($args['message']) && mb_strlen($args['message']) > 4096) {
|
if (isset($args['message']) && is_string($args['message']) && mb_strlen($args['message']) > 4096) {
|
||||||
$message_chunks = $this->split_to_chunks($args['message']);
|
$message_chunks = $this->split_to_chunks($args['message']);
|
||||||
$args['message'] = array_shift($message_chunks);
|
$args['message'] = array_shift($message_chunks);
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ class RPCErrorException extends \Exception
|
|||||||
case 'CHANNEL_PRIVATE':$message = "You haven't joined this channel/supergroup"; break;
|
case 'CHANNEL_PRIVATE':$message = "You haven't joined this channel/supergroup"; break;
|
||||||
case 'FLOOD_WAIT_666':$message = 'Spooky af m8'; break;
|
case 'FLOOD_WAIT_666':$message = 'Spooky af m8'; break;
|
||||||
case 'BOT_METHOD_INVALID':$message = 'This method cannot be run by a bot'; break;
|
case 'BOT_METHOD_INVALID':$message = 'This method cannot be run by a bot'; break;
|
||||||
default: \Rollbar\Rollbar::report_exception($this);
|
default: \Rollbar\Rollbar::log($this);
|
||||||
|
|
||||||
}
|
}
|
||||||
parent::__construct($message, $code, $previous);
|
parent::__construct($message, $code, $previous);
|
||||||
|
Loading…
Reference in New Issue
Block a user