Fix "file an issue" error

This commit is contained in:
Csonka Mihaly 2020-03-22 23:38:06 +01:00
parent 4bc9b00a52
commit 09dfc32d2c
2 changed files with 10 additions and 8 deletions

View file

@ -1,7 +1,5 @@
extern crate navi;
use navi::FileAnIssue;
fn main() -> Result<(), FileAnIssue> {
navi::handle_config(navi::config_from_env()).map_err(FileAnIssue::new)
fn main() -> Result<(), anyhow::Error> {
navi::handle_config(navi::config_from_env()).map_err(|e| navi::FileAnIssue::new(e).into())
}

View file

@ -3,17 +3,21 @@ use thiserror::Error;
#[derive(Error, Debug)]
#[error(
"Hey listen! Navi encountered a problem.
"\rHey listen! Navi encountered a problem.
Do you think this is a bug? File an issue at https://github.com/denisidoro/navi."
)]
pub struct FileAnIssue(#[source] anyhow::Error);
pub struct FileAnIssue {
#[source]
source: anyhow::Error,
}
impl FileAnIssue {
pub fn new<SourceError>(source: SourceError) -> Self
where
SourceError: Into<anyhow::Error>,
{
FileAnIssue(source.into())
FileAnIssue {
source: source.into(),
}
}
}