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
24
src/errors.rs
Normal file
24
src/errors.rs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
use thiserror::Error;
|
||||
|
||||
pub type NyxResult<T, E = NyxError> = core::result::Result<T, E>;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum NyxError {
|
||||
#[error("I/O error: {0}")]
|
||||
Io(#[from] std::io::Error),
|
||||
|
||||
#[error("SQLite error: {0}")]
|
||||
Sql(#[from] rusqlite::Error),
|
||||
|
||||
#[error("tree-sitter error: {0}")]
|
||||
TreeSitter(#[from] tree_sitter::LanguageError),
|
||||
|
||||
#[error("connection-pool error: {0}")]
|
||||
Pool(#[from] r2d2::Error),
|
||||
|
||||
#[error("time error: {0}")]
|
||||
Time(#[from] std::time::SystemTimeError),
|
||||
|
||||
#[error("other: {0}")]
|
||||
Other(String),
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue