connection error instead of varint error

This commit is contained in:
MeexReay 2024-11-14 12:16:30 +03:00
parent 26a78af446
commit abe738aad5
2 changed files with 4 additions and 4 deletions

View file

@ -5,7 +5,7 @@ macro_rules! size_varint {
let mut size: usize = 0;
loop {
let next = DataBufferReader::read_byte($self).or(Err(ProtocolError::VarIntError))?;
let next = DataBufferReader::read_byte($self)?;
size += 1;
if shift >= (std::mem::size_of::<$type>() * 8) as $type {
@ -29,7 +29,7 @@ macro_rules! read_varint {
let mut decoded: $type = 0;
loop {
let next = DataBufferReader::read_byte($self).or(Err(ProtocolError::VarIntError))?;
let next = DataBufferReader::read_byte($self)?;
if shift >= (std::mem::size_of::<$type>() * 8) as $type {
return Err(ProtocolError::VarIntError);