Skip to content

Commit

Permalink
fix: return error in normalization instead of unwrap() (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
holtgrewe authored Mar 30, 2023
1 parent f70bb91 commit 8144db6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/normalizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,15 +272,21 @@ impl<'a> Normalizer<'a> {
.find(|(idx, _x)| {
loc_range.start >= exon_starts[*idx] && loc_range.start < exon_ends[*idx]
})
.unwrap()
.ok_or(anyhow::anyhow!(
"Cannot find exon for normalization of start of {}",
&var
))?
.0;
let j = exon_starts
.iter()
.enumerate()
.find(|(idx, _x)| {
loc_range.end > exon_starts[*idx] && loc_range.end - 1 < exon_ends[*idx]
})
.unwrap()
.ok_or(anyhow::anyhow!(
"Cannot find exon for normalization of end of {}",
&var
))?
.0;

if i != j {
Expand Down

0 comments on commit 8144db6

Please sign in to comment.