-
Couldn't load subscription status.
- Fork 88
Description
In PR #165 (now superseded by PR #214 ), the review led to the idea of defining generic errors like FileNotFound and NonUnicodePath on the highest level of the crate, i.e. in a new file src/errors.rs. This avoids redundantly defining such errors for all submodules. Currently, the two example errors are defined both for bam, tbx and faidx:
Lines 21 to 24 in 61b0644
| #[snafu(display("file not found: {}", path.display()))] | |
| FileNotFound { path: PathBuf }, | |
| #[snafu(display("invalid (non-unique) characters in path"))] | |
| NonUnicodePath, |
Lines 15 to 18 in 61b0644
| #[snafu(display("file not found: {}", path.display()))] | |
| FileNotFound { path: PathBuf }, | |
| #[snafu(display("invalid (non-unique) characters in path"))] | |
| NonUnicodePath, |
rust-htslib/src/faidx/errors.rs
Lines 9 to 12 in 29565f9
| #[snafu(display("file not found: {}", path.display()))] | |
| FileNotFound { path: PathBuf }, | |
| #[snafu(display("invalid (non-unicode) characters in path"))] | |
| NonUnicodePath, |
And NonUnicodePath is also defined for bcf, but FileNotFound is missing there. So such high-level definition could also help clean up the errors a bit:
Lines 40 to 41 in 61b0644
| #[snafu(display("invalid (non-unique) characters in path"))] | |
| NonUnicodePath, |