Log errors

This commit is contained in:
Maciej Hirsz 2019-11-06 16:41:40 +01:00
parent 93484512b8
commit 17bac1d90f
2 changed files with 13 additions and 4 deletions

View File

@ -24,6 +24,7 @@ actix-http = "0.2.5"
actix-codec = "0.1.2"
bytes = "0.4"
futures = "0.1.25"
log = "0.4"
[dev-dependencies]
env_logger = "0.6"

View File

@ -1,4 +1,6 @@
//! Websocket integration
use log::error;
use std::collections::VecDeque;
use std::io;
@ -556,7 +558,7 @@ where
let data = data.unwrap_or_else(|| BytesMut::new());
if self.collector.is_initialized() {
// Previous collection was already finalized
error!("Initialize a new fragmented sequence while another is active.");
return Err(ProtocolError::NoContinuation);
}
@ -567,7 +569,7 @@ where
let data = data.unwrap_or_else(|| BytesMut::new());
if self.collector.is_initialized() {
// Previous collection was already finalized
error!("Initialize a new fragmented sequence while another is active.");
return Err(ProtocolError::NoContinuation);
}
@ -582,7 +584,10 @@ where
buf.extend_from_slice(data);
}
// Uninitialized continuation
_ => return Err(ProtocolError::NoContinuation),
_ => {
error!("Trying to continue an uninitialized sequence of fragmented frames.");
return Err(ProtocolError::NoContinuation);
}
}
None
@ -602,7 +607,10 @@ where
Some(Message::Binary(buf.freeze()))
}
// Uninitialized continuation
Collector::Uninitialized => return Err(ProtocolError::NoContinuation),
Collector::Uninitialized => {
error!("Trying to end an uninitialized sequence of fragmented frames.");
return Err(ProtocolError::NoContinuation);
}
}
}
};