mirror of
https://github.com/denisidoro/navi
synced 2024-11-13 23:37:10 +00:00
Add wrapper error telling the user to file an issue
This commit is contained in:
parent
a625b0aea0
commit
4bc9b00a52
4 changed files with 24 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
|||
extern crate navi;
|
||||
|
||||
use anyhow::Error;
|
||||
use navi::FileAnIssue;
|
||||
|
||||
fn main() -> Result<(), Error> {
|
||||
navi::handle_config(navi::config_from_env())
|
||||
fn main() -> Result<(), FileAnIssue> {
|
||||
navi::handle_config(navi::config_from_env()).map_err(FileAnIssue::new)
|
||||
}
|
||||
|
|
|
@ -15,4 +15,5 @@ mod terminal;
|
|||
mod welcome;
|
||||
|
||||
pub use handler::handle_config;
|
||||
pub use structures::error::file_issue::FileAnIssue;
|
||||
pub use structures::option::{config_from_env, config_from_iter};
|
||||
|
|
19
src/structures/error/file_issue.rs
Normal file
19
src/structures/error/file_issue.rs
Normal file
|
@ -0,0 +1,19 @@
|
|||
use std::fmt::Debug;
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
#[error(
|
||||
"Hey 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);
|
||||
|
||||
impl FileAnIssue {
|
||||
pub fn new<SourceError>(source: SourceError) -> Self
|
||||
where
|
||||
SourceError: Into<anyhow::Error>,
|
||||
{
|
||||
FileAnIssue(source.into())
|
||||
}
|
||||
}
|
|
@ -1,2 +1,3 @@
|
|||
pub mod command;
|
||||
pub mod file_issue;
|
||||
pub mod filesystem;
|
||||
|
|
Loading…
Reference in a new issue