Skip to content

Commit

Permalink
fix: do not panic when pattern is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
HerringtonDarkholme committed Sep 1, 2024
1 parent 83eb109 commit 8255ddf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/dump_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub fn dump_pattern(query: String, selector: Option<String>) -> Result<PatternTr
let pattern = if let Some(sel) = selector {
Pattern::contextual(&query, &sel, lang)?
} else {
Pattern::new(&query, lang)
Pattern::try_new(&query, lang)?
};
let found = root.root().find(&pattern).ok_or_else(|| JsError::new("pattern node not found"))?;
let ret = dump_pattern_tree(root.root(), found.node_id(), &pattern.node);
Expand Down

0 comments on commit 8255ddf

Please sign in to comment.