Files
dioxus/packages/cli/src/error.rs
T
Evan AlmloffandJonathan Kelley 79613f9db9 DX components command (#4669)
* add component subcommand

* add dx component add, remove and list commands

* handle rust dependencies

* handle component dependencies

* fetch remote registries

* sort components before listing them

* remove local dependency

* move te component manifest into the dioxus workspace

* add additional instalation instructions the first time the component
module is created

* fix mod name

* fix clippy

* improve docs and move to the main branch of components

* fix typos

* more typos

* undo const-serialize changes

* remove a few unwraps

* Allow adding multiple components at once and add a `--all` flag

* add options to the config for the base path, global asset path and
default registry

* component_path -> component_dir

* component_dir is always relative to the crate root

* fix clippy

* fix request imports

* wip: code style changes

* rename to "components" instead of "component"

* bump lock

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2025-10-20 17:20:46 -04:00

34 lines
992 B
Rust

pub(crate) type Result<T, E = Error> = std::result::Result<T, E>;
pub use anyhow::Error;
use itertools::Itertools;
pub fn log_stacktrace(err: &anyhow::Error, padding: usize) -> String {
let mut trace = format!("{err}",);
for (idx, cause) in err.chain().enumerate().skip(1) {
trace.push_str(&format!(
"\n{}{IDX_STYLE}{idx}{IDX_STYLE:#}: {}",
" ".repeat(padding),
cause
.to_string()
.lines()
.enumerate()
.map(|(idx, line)| {
if idx == 0 {
line.to_string()
} else {
format!("{}{}", " ".repeat(padding + 3), line)
}
})
.join("\n"),
IDX_STYLE = crate::styles::GLOW_STYLE,
));
}
if crate::verbosity_or_default().trace {
trace.push_str(&format!("\nBacktrace:\n{}", err.backtrace()));
}
trace
}