Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 50 additions & 88 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ license = "MIT OR Apache-2.0"
repository = "https://github.com/eyre-rs/eyre"
readme = "README.md"
rust-version = "1.65.0"
include = ["README.md", "LICENSE-APACHE", "LICENSE-MIT", "build.rs", "Cargo.toml", "src/**/*.rs"]

[workspace.dependencies]
indenter = "0.3.0"
Expand Down
4 changes: 3 additions & 1 deletion color-eyre/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ license = { workspace = true }
repository = { workspace = true }
readme = { workspace = true }
rust-version = { workspace = true }
include.workspace = true

[features]
default = ["track-caller", "capture-spantrace"]
Expand All @@ -32,7 +33,8 @@ tracing-subscriber = { version = "0.3.0", features = ["env-filter"] }
tracing = "0.1.13"
pretty_assertions = "1.0.0"
thiserror = "1.0.19"
ansi-parser = "0.8.0"
ansi-parser = "0.9.0"
rustversion = "1.0"

[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test = "0.3.15"
Expand Down
8 changes: 4 additions & 4 deletions color-eyre/examples/multiple_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ fn join_errors(results: Vec<Result<(), SourceError>>) -> Result<(), Report> {
fn get_errors() -> Vec<Result<(), SourceError>> {
vec![
Err(SourceError {
source: StrError("The task you ran encountered an error"),
_source: StrError("The task you ran encountered an error"),
msg: "The task could not be completed",
}),
Err(SourceError {
source: StrError("The machine you're connecting to is actively on fire"),
_source: StrError("The machine you're connecting to is actively on fire"),
msg: "The machine is unreachable",
}),
Err(SourceError {
source: StrError("The file you're parsing is literally written in c++ instead of rust, what the hell"),
_source: StrError("The file you're parsing is literally written in c++ instead of rust, what the hell"),
msg: "The file could not be parsed",
}),
]
Expand All @@ -51,5 +51,5 @@ struct StrError(&'static str);
#[error("{msg}")]
struct SourceError {
msg: &'static str,
source: StrError,
_source: StrError,
}
37 changes: 18 additions & 19 deletions color-eyre/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -874,25 +874,24 @@ fn print_panic_info(report: &PanicReport<'_>, f: &mut fmt::Formatter<'_>) -> fmt
{
let payload = report.panic_info.payload();

if report.hook.issue_url.is_some()
&& (*report.hook.issue_filter)(crate::ErrorKind::NonRecoverable(payload))
{
let url = report.hook.issue_url.as_ref().unwrap();
let payload = payload
.downcast_ref::<String>()
.map(String::as_str)
.or_else(|| payload.downcast_ref::<&str>().cloned())
.unwrap_or("<non string panic payload>");

let issue_section = crate::section::github::IssueSection::new(url, payload)
.with_backtrace(report.backtrace.as_ref())
.with_location(report.panic_info.location())
.with_metadata(&report.hook.issue_metadata);

#[cfg(feature = "capture-spantrace")]
let issue_section = issue_section.with_span_trace(report.span_trace.as_ref());

write!(&mut separated.ready(), "{issue_section}")?;
if let Some(url) = report.hook.issue_url.as_ref() {
if (*report.hook.issue_filter)(crate::ErrorKind::NonRecoverable(payload)) {
let payload = payload
.downcast_ref::<String>()
.map(String::as_str)
.or_else(|| payload.downcast_ref::<&str>().cloned())
.unwrap_or("<non string panic payload>");

let issue_section = crate::section::github::IssueSection::new(url, payload)
.with_backtrace(report.backtrace.as_ref())
.with_location(report.panic_info.location())
.with_metadata(&report.hook.issue_metadata);

#[cfg(feature = "capture-spantrace")]
let issue_section = issue_section.with_span_trace(report.span_trace.as_ref());

write!(&mut separated.ready(), "{issue_section}")?;
}
}
}

Expand Down
Loading
Loading