Skip to content

Commit 3f078ec

Browse files
committed
replace unwrap with error
1 parent 74fa61b commit 3f078ec

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

tmc-langs-framework/src/error.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ pub enum TmcError {
3838
FileNotInProject(PathBuf, PathBuf),
3939
#[error("Path {0} is not absolute")]
4040
PathNotAbsolute(PathBuf),
41+
#[error("Error while parsing available points: {0}")]
42+
PointParse(String),
4143

4244
#[error("Path {0} contained invalid UTF8")]
4345
UTF8(PathBuf),

tmc-langs-framework/src/plugin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ pub trait LanguagePlugin {
494494
branch::alt((line_comment_parser, block_comment_parser, points_parser)),
495495
));
496496
let res: IResult<_, _> = parser(&file_contents);
497-
let (_, parsed) = res.unwrap();
497+
let (_, parsed) = res.map_err(|e| TmcError::PointParse(e.to_string()))?;
498498
for (_, parse) in parsed {
499499
if let Parse::Points(parsed) = parse {
500500
points.push(parsed);

0 commit comments

Comments
 (0)