Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ key1:a2
";
assert!(YamlLoader::load_from_str(s).is_err());
assert!(try_fail(s).is_err());
assert_eq!(
try_fail(s).unwrap_err().info(),
"mapping values are not allowed in this context"
);
assert_eq!(
try_fail(s).unwrap_err().to_string(),
"mapping values are not allowed in this context at line 4 column 4"
);
}

}
4 changes: 4 additions & 0 deletions src/scanner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ impl ScanError {
pub fn marker(&self) -> &Marker {
&self.mark
}

pub fn info(&self) -> &str {
self.info.as_ref()
}
}

impl Error for ScanError {
Expand Down