Carry irritant in parse error
This commit is contained in:
parent
06c2347e87
commit
c41fe3df3e
|
@ -44,7 +44,7 @@ pub enum Out {
|
|||
#[derive(Debug)]
|
||||
pub enum DecodeError {
|
||||
Read(value::decoder::Error),
|
||||
Parse(value::error::Error),
|
||||
Parse(value::error::Error, V),
|
||||
}
|
||||
|
||||
impl From<io::Error> for DecodeError {
|
||||
|
@ -53,12 +53,6 @@ impl From<io::Error> for DecodeError {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<value::error::Error> for DecodeError {
|
||||
fn from(v: value::error::Error) -> Self {
|
||||
DecodeError::Parse(v)
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -111,7 +105,10 @@ impl tokio::codec::Decoder for Codec {
|
|||
let final_len = buf.len();
|
||||
bs.advance(orig_len - final_len);
|
||||
match res {
|
||||
Ok(v) => Ok(Some(value::from_value(&v)?)),
|
||||
Ok(v) => match value::from_value(&v) {
|
||||
Ok(p) => Ok(Some(p)),
|
||||
Err(e) => Err(DecodeError::Parse(e, v))
|
||||
}
|
||||
Err(value::decoder::Error::Eof) => Ok(None),
|
||||
Err(e) => Err(DecodeError::Read(e)),
|
||||
}
|
||||
|
|
|
@ -93,8 +93,9 @@ impl Peer {
|
|||
to_send.push(err(s));
|
||||
running = false;
|
||||
}
|
||||
Err(packets::DecodeError::Parse(e)) => {
|
||||
to_send.push(err(&format!("Packet deserialization error: {:?}", e)));
|
||||
Err(packets::DecodeError::Parse(e, v)) => {
|
||||
to_send.push(err(&format!(
|
||||
"Packet deserialization error ({}) decoding {:?} ", e, v)));
|
||||
running = false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue