mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
Block: add the current class to the exception messages for block runtime data serialization
This commit is contained in:
parent
8b2d941502
commit
20cb67461f
@ -47,6 +47,7 @@ use pocketmine\world\format\Chunk;
|
||||
use pocketmine\world\Position;
|
||||
use pocketmine\world\World;
|
||||
use function count;
|
||||
use function get_class;
|
||||
use const PHP_INT_MAX;
|
||||
|
||||
class Block{
|
||||
@ -109,7 +110,7 @@ class Block{
|
||||
$this->decodeType($reader);
|
||||
$readBits = $reader->getOffset();
|
||||
if($typeBits !== $readBits){
|
||||
throw new \LogicException("Exactly $typeBits bits of type data were provided, but $readBits were read");
|
||||
throw new \LogicException(get_class($this) . ": Exactly $typeBits bits of type data were provided, but $readBits were read");
|
||||
}
|
||||
}
|
||||
|
||||
@ -126,7 +127,7 @@ class Block{
|
||||
$this->decodeState($reader);
|
||||
$readBits = $reader->getOffset() - $typeBits;
|
||||
if($stateBits !== $readBits){
|
||||
throw new \LogicException("Exactly $stateBits bits of state data were provided, but $readBits were read");
|
||||
throw new \LogicException(get_class($this) . ": Exactly $stateBits bits of state data were provided, but $readBits were read");
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,7 +150,7 @@ class Block{
|
||||
$this->encodeType($writer);
|
||||
$writtenBits = $writer->getOffset();
|
||||
if($typeBits !== $writtenBits){
|
||||
throw new \LogicException("Exactly $typeBits bits of type data were expected, but $writtenBits were written");
|
||||
throw new \LogicException(get_class($this) . ": Exactly $typeBits bits of type data were expected, but $writtenBits were written");
|
||||
}
|
||||
|
||||
return $writer->getValue();
|
||||
@ -168,7 +169,7 @@ class Block{
|
||||
$this->encodeState($writer);
|
||||
$writtenBits = $writer->getOffset() - $typeBits;
|
||||
if($stateBits !== $writtenBits){
|
||||
throw new \LogicException("Exactly $stateBits bits of state data were expected, but $writtenBits were written");
|
||||
throw new \LogicException(get_class($this) . ": Exactly $stateBits bits of state data were expected, but $writtenBits were written");
|
||||
}
|
||||
|
||||
return $writer->getValue();
|
||||
|
Loading…
x
Reference in New Issue
Block a user