Skip to content

Commit 23cb6bf

Browse files
committed
feat(console): only suggest opening issues for panics (tokio-rs#365)
This changes the console CLI's error handling so that GitHub issues are only suggested for panics, not for recoverable errors (such as "no config file found", "couldn't connect to remote host", etc).
1 parent 40e2f6f commit 23cb6bf

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

Diff for: tokio-console/src/view/styles.rs

+14-2
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,23 @@ impl Styles {
4848
}
4949

5050
pub fn error_init(&self) -> color_eyre::Result<()> {
51-
use color_eyre::config::{HookBuilder, Theme};
51+
use color_eyre::{
52+
config::{HookBuilder, Theme},
53+
ErrorKind,
54+
};
5255

5356
let mut builder = HookBuilder::new()
5457
.issue_url(concat!(env!("CARGO_PKG_REPOSITORY"), "/issues/new"))
55-
.add_issue_metadata("version", env!("CARGO_PKG_VERSION"));
58+
.add_issue_metadata("version", env!("CARGO_PKG_VERSION"))
59+
.issue_filter(|kind| match kind {
60+
// Only suggest reporting GitHub issues for panics, not for
61+
// errors, so people don't open GitHub issues for stuff like not
62+
// being able to find a config file or connections being
63+
// terminated by remote hosts.
64+
ErrorKind::NonRecoverable(_) => true,
65+
ErrorKind::Recoverable(_) => false,
66+
});
67+
5668
if self.palette == Palette::NoColors {
5769
// disable colors in error reports
5870
builder = builder.theme(Theme::new());

0 commit comments

Comments
 (0)