mirror of
https://github.com/denisidoro/navi
synced 2024-11-13 23:37:10 +00:00
Fix "file an issue" error
This commit is contained in:
parent
4bc9b00a52
commit
09dfc32d2c
2 changed files with 10 additions and 8 deletions
|
@ -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())
|
||||
}
|
||||
|
|
|
@ -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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue