Skip to content

Commit

Permalink
convert an unwrap to use ParseError
Browse files Browse the repository at this point in the history
Signed-off-by: kdesjard <kristian.desjardins@nrcan-rncan.gc.ca>
  • Loading branch information
Kris-Desjardins committed Dec 12, 2023
1 parent ca2c71f commit 0bb9471
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/yaml/yaml_parser.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Default yaml configuration file parser.

use super::{FileContentError, FileNotFound, YamlTask, YamlTaskError};
use super::{FileContentError, YamlTask, YamlTaskError};
use crate::{utils::ParseError, Action, CommandAction, Parser, Task, utils::file::load_file};
use std::{collections::HashMap, sync::Arc};
use yaml_rust::{Yaml, YamlLoader};
Expand Down Expand Up @@ -81,7 +81,7 @@ impl Parser for YamlParser {
let mut map = HashMap::with_capacity(yaml_tasks.len());
// Read tasks
for (v, w) in yaml_tasks {
let id = v.as_str().unwrap();
let id = v.as_str().ok_or(ParseError("Invalid YAML Node Type".to_string()))?;
let task = specific_actions.remove(id).map_or_else(
|| self.parse_one(id, w, None),
|action| self.parse_one(id, w, Some(action)),
Expand Down

0 comments on commit 0bb9471

Please sign in to comment.