preceding bytes output changes if you error before position 5
This commit is contained in:
parent
56984dea36
commit
360a5b6017
|
@ -195,9 +195,11 @@ where
|
||||||
6 => Ok(Term::Error),
|
6 => Ok(Term::Error),
|
||||||
7 => Ok(Term::Builtin(DefaultFunction::decode(d)?)),
|
7 => Ok(Term::Builtin(DefaultFunction::decode(d)?)),
|
||||||
x => Err(de::Error::Message(format!(
|
x => Err(de::Error::Message(format!(
|
||||||
"Unknown term constructor tag: {}{} {:02X?} {} {} {} {}",
|
"Unknown term constructor tag: {}{}{} {} {:02X?} {} {} {} {}",
|
||||||
x,
|
x,
|
||||||
".\n\nHere are the buffer bytes (5 preceding) ",
|
".\n\nHere are the buffer bytes (",
|
||||||
|
if d.pos > 5 { 5 } else { d.pos },
|
||||||
|
"preceding) ",
|
||||||
d.buffer
|
d.buffer
|
||||||
.iter()
|
.iter()
|
||||||
.skip(if d.pos - 5 > 0 { d.pos - 5 } else { 0 })
|
.skip(if d.pos - 5 > 0 { d.pos - 5 } else { 0 })
|
||||||
|
@ -364,9 +366,11 @@ where
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
Err(de::Error::Message(format!(
|
Err(de::Error::Message(format!(
|
||||||
"Unknown term constructor tag: {}{} {:02X?} {} {} {} {}",
|
"Unknown term constructor tag: {}{}{} {} {:02X?} {} {} {} {}",
|
||||||
x,
|
x,
|
||||||
".\n\nHere are the buffer bytes (5 preceding) ",
|
".\n\nHere are the buffer bytes (",
|
||||||
|
if d.pos > 5 { 5 } else { d.pos },
|
||||||
|
"preceding) ",
|
||||||
buffer_slice,
|
buffer_slice,
|
||||||
"\n\nBuffer position is",
|
"\n\nBuffer position is",
|
||||||
d.pos,
|
d.pos,
|
||||||
|
|
Loading…
Reference in New Issue