MCPcopy Create free account
hub / github.com/cargo-lambda/cargo-lambda / error_hook

Function error_hook

crates/cargo-lambda-cli/src/main.rs:332–349  ·  view source on GitHub ↗
(color: Option<&Color>)

Source from the content-addressed store, hash-verified

330}
331
332fn error_hook(color: Option<&Color>) -> ErrorHook {
333 let ansi = match color {
334 Some(color) => color.is_ansi(),
335 None => {
336 let color = std::env::var("CARGO_LAMBDA_COLOR");
337 Color::try_from(color.as_deref().unwrap_or("auto"))
338 .expect("invalid color option, must be auto, always, or never")
339 .is_ansi()
340 }
341 };
342 Box::new(move |_| {
343 Box::new(miette::MietteHandlerOpts::new()
344 .terminal_links(true)
345 .footer("Was this behavior unexpected?\nStart a thread in https://github.com/cargo-lambda/cargo-lambda/discussions".into())
346 .color(ansi)
347 .build())
348 })
349}
350
351fn run_zig(zig: Zig) -> Result<()> {
352 miette::set_hook(error_hook(None))?;

Callers 2

mainFunction · 0.85
run_zigFunction · 0.85

Calls 3

newFunction · 0.85
is_ansiMethod · 0.80
buildMethod · 0.80

Tested by

no test coverage detected