IntoAnyhowWithContext

Trait IntoAnyhowWithContext 

Source
pub trait IntoAnyhowWithContext {
    // Required method
    fn into_anyhow_with_context(self, context: ErrorContext) -> Error;
}
Expand description

Extension trait for converting AgpmError to anyhow::Error with context

This trait provides a method to convert AGPM-specific errors into generic anyhow::Error instances while preserving user-friendly context information.

§Examples

use agpm_cli::core::{AgpmError, ErrorContext, IntoAnyhowWithContext};

let error = AgpmError::GitNotFound;
let context = ErrorContext::new(AgpmError::Other { message: "dummy".to_string() })
    .with_suggestion("Install git");

let anyhow_error = error.into_anyhow_with_context(context);

Required Methods§

Source

fn into_anyhow_with_context(self, context: ErrorContext) -> Error

Convert the error to an anyhow::Error with the provided context

Implementors§