Skip to content
220 changes: 219 additions & 1 deletion Cargo.lock

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

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ path = "src/main.rs"
[dev-dependencies]
stats = { path = "stats" }
ignore = "0.4"
assert_cmd = "2"
predicates = "3"
proptest = "1"

[[bench]]
name = "benchmarks"
Expand Down
9 changes: 9 additions & 0 deletions perf.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,14 @@ files = [
"xtask/src/bench.rs",
"xtask/src/find_entry.rs",
"tests/perf_registry.rs",
"tests/common/mod.rs",
"tests/cli.rs",
"tests/session_reports.rs",
"tests/json_roundtrip.rs",
"tests/git_refs.rs",
"tests/cache_safety.rs",
"tests/negative_cases.rs",
"tests/property.rs",
"tests/report_battery.rs",
]
benchmarks = []
21 changes: 21 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ pub enum Error {
InvalidTopValue(&'static str, i32),
/// Readline/REPL initialization failed.
Readline(String),
/// --max-weight threshold exceeded.
MaxWeightExceeded {
kind: &'static str,
weight: u64,
module_count: usize,
threshold: u64,
},
}

impl Error {
Expand Down Expand Up @@ -113,6 +120,20 @@ impl std::fmt::Display for Error {
write!(f, "invalid value {n} for {flag}: must be -1 (all) or 0+")
}
Self::Readline(msg) => write!(f, "readline: {msg}"),
Self::MaxWeightExceeded {
kind,
weight,
module_count,
threshold,
} => {
let plural = if *module_count == 1 { "" } else { "s" };
write!(
f,
"{kind} transitive weight {} ({module_count} module{plural}) exceeds --max-weight threshold {}",
crate::report::format_size(*weight),
crate::report::format_size(*threshold),
)
}
}
}
}
Expand Down
Loading