pub enum DebtmapError {
Io {
code: ErrorCode,
message: String,
path: Option<PathBuf>,
source: Option<Arc<Error>>,
},
Parse {
code: ErrorCode,
message: String,
path: PathBuf,
line: Option<usize>,
column: Option<usize>,
},
Config {
code: ErrorCode,
message: String,
field: Option<String>,
path: Option<PathBuf>,
},
Analysis {
code: ErrorCode,
message: String,
phase: Option<AnalysisPhase>,
},
Cli {
code: ErrorCode,
message: String,
arg: Option<String>,
},
Validation {
code: ErrorCode,
count: usize,
errors: Vec<String>,
},
}Expand description
Unified error type for debtmap operations.
This enum consolidates all error types across the codebase into a single, well-structured type with error codes, classification methods, and context.
Variants§
Io
I/O and filesystem errors.
Fields
Parse
Source code parsing errors.
Fields
Config
Configuration errors.
Fields
Analysis
Analysis execution errors.
Fields
phase: Option<AnalysisPhase>Analysis phase where error occurred.
Cli
CLI argument errors.
Fields
Validation
Validation errors (may contain multiple issues).
Implementations§
Source§impl DebtmapError
impl DebtmapError
Sourcepub fn io(message: impl Into<String>, path: Option<PathBuf>) -> Self
pub fn io(message: impl Into<String>, path: Option<PathBuf>) -> Self
Create an I/O error with a message and optional path.
Sourcepub fn from_io_error(err: Error, path: Option<PathBuf>) -> Self
pub fn from_io_error(err: Error, path: Option<PathBuf>) -> Self
Create an I/O error from a std::io::Error.
Sourcepub fn parse(
message: impl Into<String>,
path: impl Into<PathBuf>,
line: Option<usize>,
column: Option<usize>,
) -> Self
pub fn parse( message: impl Into<String>, path: impl Into<PathBuf>, line: Option<usize>, column: Option<usize>, ) -> Self
Create a parse error with context.
Sourcepub fn parse_syntax(
message: impl Into<String>,
path: impl Into<PathBuf>,
line: Option<usize>,
column: Option<usize>,
) -> Self
pub fn parse_syntax( message: impl Into<String>, path: impl Into<PathBuf>, line: Option<usize>, column: Option<usize>, ) -> Self
Create a parse error with syntax error code.
Sourcepub fn config_with_field(
message: impl Into<String>,
field: impl Into<String>,
) -> Self
pub fn config_with_field( message: impl Into<String>, field: impl Into<String>, ) -> Self
Create a configuration error with field context.
Sourcepub fn config_with_path(
message: impl Into<String>,
path: impl Into<PathBuf>,
) -> Self
pub fn config_with_path( message: impl Into<String>, path: impl Into<PathBuf>, ) -> Self
Create a configuration error with path context.
Sourcepub fn analysis_with_phase(
message: impl Into<String>,
phase: AnalysisPhase,
) -> Self
pub fn analysis_with_phase( message: impl Into<String>, phase: AnalysisPhase, ) -> Self
Create an analysis error with phase context.
Sourcepub fn cli_invalid_command(message: impl Into<String>) -> Self
pub fn cli_invalid_command(message: impl Into<String>) -> Self
Create a CLI error for invalid command.
Sourcepub fn cli_missing_arg(arg: impl Into<String>) -> Self
pub fn cli_missing_arg(arg: impl Into<String>) -> Self
Create a CLI error for missing argument.
Sourcepub fn cli_invalid_arg(
arg: impl Into<String>,
reason: impl Into<String>,
) -> Self
pub fn cli_invalid_arg( arg: impl Into<String>, reason: impl Into<String>, ) -> Self
Create a CLI error for invalid argument.
Sourcepub fn validation(message: impl Into<String>) -> Self
pub fn validation(message: impl Into<String>) -> Self
Create a validation error with a single message.
Sourcepub fn validations(errors: Vec<String>) -> Self
pub fn validations(errors: Vec<String>) -> Self
Create a validation error with multiple messages.
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Check if this error is potentially transient and retryable.
Retryable errors are those that might succeed on a subsequent attempt:
- Resource busy / file locks
- Network timeouts
- Coverage loading (external tool issues)
Non-retryable errors include:
- Parse/syntax errors
- Configuration errors
- Validation errors
- File not found (permanent)
Sourcepub fn is_user_fixable(&self) -> bool
pub fn is_user_fixable(&self) -> bool
Check if this error is something the user can fix.
User-fixable errors include:
- Configuration errors (fix config file)
- CLI errors (fix command arguments)
- Validation errors (fix input)
- Parse errors (fix source code)
Non-user-fixable errors include:
- I/O errors (system issues)
- Analysis errors (internal algorithm issues)
Trait Implementations§
Source§impl Clone for DebtmapError
impl Clone for DebtmapError
Source§fn clone(&self) -> DebtmapError
fn clone(&self) -> DebtmapError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DebtmapError
impl Debug for DebtmapError
Source§impl Display for DebtmapError
impl Display for DebtmapError
Source§impl Error for DebtmapError
impl Error for DebtmapError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<AnalysisError> for DebtmapError
impl From<AnalysisError> for DebtmapError
Source§fn from(err: AnalysisError) -> Self
fn from(err: AnalysisError) -> Self
Source§impl From<AnalysisError> for DebtmapError
impl From<AnalysisError> for DebtmapError
Source§fn from(err: AnalysisError) -> Self
fn from(err: AnalysisError) -> Self
Source§impl From<AppError> for DebtmapError
impl From<AppError> for DebtmapError
Source§impl From<CliError> for DebtmapError
impl From<CliError> for DebtmapError
Source§impl From<ConfigError> for DebtmapError
impl From<ConfigError> for DebtmapError
Source§fn from(err: ConfigError) -> Self
fn from(err: ConfigError) -> Self
Source§impl From<Error> for DebtmapError
impl From<Error> for DebtmapError
Source§impl From<Error> for DebtmapError
impl From<Error> for DebtmapError
Source§impl From<Error> for DebtmapError
impl From<Error> for DebtmapError
Auto Trait Implementations§
impl Freeze for DebtmapError
impl !RefUnwindSafe for DebtmapError
impl Send for DebtmapError
impl Sync for DebtmapError
impl Unpin for DebtmapError
impl !UnwindSafe for DebtmapError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> EnsureExt<T> for T
impl<T> EnsureExt<T> for T
Source§fn ensure<P, E>(self, predicate: P, error: E) -> Validation<T, NonEmptyVec<E>>where
P: Predicate<T>,
fn ensure<P, E>(self, predicate: P, error: E) -> Validation<T, NonEmptyVec<E>>where
P: Predicate<T>,
Source§fn ensure_with<P, E, F>(
self,
predicate: P,
error_fn: F,
) -> Validation<T, NonEmptyVec<E>>
fn ensure_with<P, E, F>( self, predicate: P, error_fn: F, ) -> Validation<T, NonEmptyVec<E>>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more