Skip to main content

last_error

Function last_error 

Source
pub fn last_error() -> Option<XetError>
Expand description

Get the last XET filter error from this thread

When a git operation fails and XET filter was involved, this function can provide detailed error information that wouldn’t be available through git2’s error handling.

§Example

ⓘ
use git2::Repository;
use git2db::xet_filter;

let repo = Repository::open("path/to/repo")?;
if let Err(e) = repo.checkout_head(None) {
    // Git operation failed - check if XET filter has details
    if let Some(xet_error) = xet_filter::last_error() {
        eprintln!("XET filter error: {:?}", xet_error);
        eprintln!("Error kind: {:?}", xet_error.kind());
        eprintln!("Message: {}", xet_error.message());
    }
}

§Thread-Local Storage

This function uses thread-local storage, so it only returns errors from git operations performed on the current thread.