mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-27 08:34:41 +01:00
fixes
This commit is contained in:
parent
a3e2744099
commit
6997826bf4
@ -14,13 +14,15 @@ namespace danog\MadelineProto;
|
||||
|
||||
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);
|
||||
if (\danog\MadelineProto\Logger::$constructed && $this->file !== __FILE__) {
|
||||
\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) {
|
||||
\danog\MadelineProto\Logger::log([$errstr.' in '.basename($errfile).':'.$errline], \danog\MadelineProto\Logger::FATAL_ERROR);
|
||||
}
|
||||
$e = new self($errstr, $errno);
|
||||
$e->file = $errfile;
|
||||
$e->line = $errline;
|
||||
$e = new self($errstr, $errno, null, $errfile, $errline);
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ trait CallHandler
|
||||
if (!isset($aargs['datacenter'])) {
|
||||
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']);
|
||||
$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 'FLOOD_WAIT_666':$message = 'Spooky af m8'; 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);
|
||||
|
Loading…
Reference in New Issue
Block a user