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:
|
#[snafu(display("file not found: {}", path.display()))] |
|
FileNotFound { path: PathBuf }, |
|
#[snafu(display("invalid (non-unique) characters in path"))] |
|
NonUnicodePath, |
|
#[snafu(display("file not found: {}", path.display()))] |
|
FileNotFound { path: PathBuf }, |
|
#[snafu(display("invalid (non-unique) characters in path"))] |
|
NonUnicodePath, |
|
#[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:
|
#[snafu(display("invalid (non-unique) characters in path"))] |
|
NonUnicodePath, |
In PR #165 (now superseded by PR #214 ), the review led to the idea of defining generic errors like
FileNotFoundandNonUnicodePathon the highest level of the crate, i.e. in a new filesrc/errors.rs. This avoids redundantly defining such errors for all submodules. Currently, the two example errors are defined both forbam,tbxandfaidx:rust-htslib/src/bam/errors.rs
Lines 21 to 24 in 61b0644
rust-htslib/src/tbx/errors.rs
Lines 15 to 18 in 61b0644
rust-htslib/src/faidx/errors.rs
Lines 9 to 12 in 29565f9
And
NonUnicodePathis also defined forbcf, butFileNotFoundis missing there. So such high-level definition could also help clean up the errors a bit:rust-htslib/src/bcf/errors.rs
Lines 40 to 41 in 61b0644