Remove errors details as they were quite useless

This commit is contained in:
CosminPerRam 2023-01-13 00:11:04 +02:00
parent e8619a7df1
commit c263b17651
13 changed files with 103 additions and 116 deletions

View file

@ -1,11 +1,12 @@
use crate::{GDResult, GDError};
use crate::GDResult;
use crate::GDError::{PacketOverflow, PacketUnderflow};
pub fn error_by_expected_size(expected: usize, size: usize) -> GDResult<()> {
if size < expected {
Err(GDError::PacketUnderflow("Unexpectedly short packet.".to_string()))
Err(PacketUnderflow)
}
else if size > expected {
Err(GDError::PacketOverflow("Unexpectedly long packet.".to_string()))
Err(PacketOverflow)
}
else {
Ok(())