mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-21 20:18:06 +02:00
Add error handling with NyxError and refactor console output formatting
- Introduced `NyxError` and `NyxResult` for unified error handling across modules. - Refactored `scan.rs`, `index.rs`, and `walk.rs` with improved error management and consistent formatting. - Replaced existing error handling in `database.rs` with `NyxResult`. - Improved database maintenance by integrating `vacuum` and `clear` methods into workflows. - Added `dashmap` for efficient parallel diagnostics result aggregation in `scan_with_index_parallel`. - Enhanced readability and formatting of console outputs in multiple modules.
This commit is contained in:
parent
75a20eaa2a
commit
0a66a0ae2d
14 changed files with 360 additions and 240 deletions
11
src/main.rs
11
src/main.rs
|
|
@ -4,6 +4,8 @@ mod utils;
|
|||
mod walk;
|
||||
mod database;
|
||||
mod patterns;
|
||||
mod errors;
|
||||
mod file;
|
||||
|
||||
use crate::utils::Config;
|
||||
use cli::Cli;
|
||||
|
|
@ -59,10 +61,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
|
||||
commands::handle_command(cli.command, database_dir, &mut config)?;
|
||||
|
||||
let elapsed: f32 = now.elapsed().as_millis() as f32 / 1000f32;
|
||||
println!("{} in {} s.",
|
||||
style("Finished").green().bold(),
|
||||
style(elapsed).white().bold());
|
||||
println!(
|
||||
"{} in {:.3}s.",
|
||||
style("Finished").green().bold(),
|
||||
now.elapsed().as_secs_f32()
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue