DebtmapError

Enum DebtmapError 

Source
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

§code: ErrorCode

Error code for documentation lookup.

§message: String

Human-readable error message.

§path: Option<PathBuf>

Associated file path, if any.

§source: Option<Arc<Error>>

Source error for debugging.

§

Parse

Source code parsing errors.

Fields

§code: ErrorCode

Error code for documentation lookup.

§message: String

Human-readable error message.

§path: PathBuf

File being parsed.

§line: Option<usize>

Line number where error occurred.

§column: Option<usize>

Column number where error occurred.

§

Config

Configuration errors.

Fields

§code: ErrorCode

Error code for documentation lookup.

§message: String

Human-readable error message.

§field: Option<String>

Configuration field name, if applicable.

§path: Option<PathBuf>

Configuration file path, if applicable.

§

Analysis

Analysis execution errors.

Fields

§code: ErrorCode

Error code for documentation lookup.

§message: String

Human-readable error message.

§phase: Option<AnalysisPhase>

Analysis phase where error occurred.

§

Cli

CLI argument errors.

Fields

§code: ErrorCode

Error code for documentation lookup.

§message: String

Human-readable error message.

§arg: Option<String>

Argument name, if applicable.

§

Validation

Validation errors (may contain multiple issues).

Fields

§code: ErrorCode

Error code for documentation lookup.

§count: usize

Number of validation errors.

§errors: Vec<String>

Individual error messages.

Implementations§

Source§

impl DebtmapError

Source

pub fn io(message: impl Into<String>, path: Option<PathBuf>) -> Self

Create an I/O error with a message and optional path.

Source

pub fn from_io_error(err: Error, path: Option<PathBuf>) -> Self

Create an I/O error from a std::io::Error.

Source

pub fn parse( message: impl Into<String>, path: impl Into<PathBuf>, line: Option<usize>, column: Option<usize>, ) -> Self

Create a parse error with context.

Source

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.

Source

pub fn config(message: impl Into<String>) -> Self

Create a configuration error.

Source

pub fn config_with_field( message: impl Into<String>, field: impl Into<String>, ) -> Self

Create a configuration error with field context.

Source

pub fn config_with_path( message: impl Into<String>, path: impl Into<PathBuf>, ) -> Self

Create a configuration error with path context.

Source

pub fn analysis(message: impl Into<String>) -> Self

Create an analysis error.

Source

pub fn analysis_with_phase( message: impl Into<String>, phase: AnalysisPhase, ) -> Self

Create an analysis error with phase context.

Source

pub fn cli(message: impl Into<String>) -> Self

Create a CLI error.

Source

pub fn cli_invalid_command(message: impl Into<String>) -> Self

Create a CLI error for invalid command.

Source

pub fn cli_missing_arg(arg: impl Into<String>) -> Self

Create a CLI error for missing argument.

Source

pub fn cli_invalid_arg( arg: impl Into<String>, reason: impl Into<String>, ) -> Self

Create a CLI error for invalid argument.

Source

pub fn validation(message: impl Into<String>) -> Self

Create a validation error with a single message.

Source

pub fn validations(errors: Vec<String>) -> Self

Create a validation error with multiple messages.

Source

pub fn code(&self) -> ErrorCode

Get the error code.

Source

pub fn category(&self) -> &'static str

Get the error category name.

Source

pub fn message(&self) -> &str

Get the error message.

Source

pub fn path(&self) -> Option<&PathBuf>

Get the associated path, if any.

Source

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)
Source

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)
Source

pub fn exit_code(&self) -> i32

Get the suggested exit code for this error.

Trait Implementations§

Source§

impl Clone for DebtmapError

Source§

fn clone(&self) -> DebtmapError

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DebtmapError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for DebtmapError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for DebtmapError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<AnalysisError> for DebtmapError

Source§

fn from(err: AnalysisError) -> Self

Converts to this type from the input type.
Source§

impl From<AnalysisError> for DebtmapError

Source§

fn from(err: AnalysisError) -> Self

Converts to this type from the input type.
Source§

impl From<AppError> for DebtmapError

Source§

fn from(err: AppError) -> Self

Converts to this type from the input type.
Source§

impl From<CliError> for DebtmapError

Source§

fn from(err: CliError) -> Self

Converts to this type from the input type.
Source§

impl From<ConfigError> for DebtmapError

Source§

fn from(err: ConfigError) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for DebtmapError

Source§

fn from(err: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for DebtmapError

Source§

fn from(err: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for DebtmapError

Source§

fn from(err: Error) -> Self

Converts to this type from the input type.
Source§

impl Serialize for DebtmapError

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> EnsureExt<T> for T

Source§

fn ensure<P, E>(self, predicate: P, error: E) -> Validation<T, NonEmptyVec<E>>
where P: Predicate<T>,

Validate that this value satisfies the given predicate. Read more
Source§

fn ensure_with<P, E, F>( self, predicate: P, error_fn: F, ) -> Validation<T, NonEmptyVec<E>>
where P: Predicate<T>, F: FnOnce(&T) -> E,

Validate with an error-generating function. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToCompactString for T
where T: Display,

Source§

impl<T> ToLine for T
where T: Display,

Source§

fn to_line(&self) -> Line<'_>

Converts the value to a Line.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToSpan for T
where T: Display,

Source§

fn to_span(&self) -> Span<'_>

Converts the value to a Span.
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> ToText for T
where T: Display,

Source§

fn to_text(&self) -> Text<'_>

Converts the value to a Text.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more