Add byte a offset to the error message
This commit is contained in:
parent
e1119bb3bf
commit
c962741719
2 changed files with 4 additions and 3 deletions
|
@ -108,10 +108,11 @@ impl fmt::Display for ScanError {
|
||||||
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(
|
write!(
|
||||||
formatter,
|
formatter,
|
||||||
"{} at line {} column {}",
|
"{} at byte {} line {} column {}",
|
||||||
self.info,
|
self.info,
|
||||||
|
self.mark.index,
|
||||||
self.mark.line,
|
self.mark.line,
|
||||||
self.mark.col + 1
|
self.mark.col + 1,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ key1:a2
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
error.to_string(),
|
error.to_string(),
|
||||||
"mapping values are not allowed in this context at line 4 column 4"
|
"mapping values are not allowed in this context at byte 26 line 4 column 4"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue