Better errors

This commit is contained in:
danogentili 2017-09-06 20:26:49 +03:00
parent e1ca8b612c
commit 058e8ca7e9

View File

@ -294,6 +294,10 @@ trait TL
case 'double':
return $this->pack_double($object);
case 'string':
if (!is_string($object)) {
throw new Exception("You didn't provide a valid string");
}
$object = pack('C*', ...unpack('C*', $object));
$l = strlen($object);
$concat = '';
@ -310,6 +314,9 @@ trait TL
return $concat;
case 'bytes':
if (!is_string($object) && !($object instanceof \danog\MadelineProto\TL\Bytes)) {
throw new Exception("You didn't provide a valid string");
}
$l = strlen($object);
$concat = '';
if ($l <= 253) {