Skip to main content

Module error

Module error 

Source
Expand description

Error types for the sara-core library.

This module defines a unified error type for all SARA operations. All errors are consolidated into the single SaraError enum with clear variants for each error category.

§Error Categories

  • File Operations: Reading and writing files
  • Parsing: Markdown and YAML frontmatter parsing
  • Validation: Graph structure and item validation
  • Configuration: Loading and validating configuration
  • Queries: Item lookup and graph traversal
  • Git Operations: Repository access and version control
  • Editing: Item modification operations

§Examples

use sara_core::error::SaraError;
use std::path::PathBuf;

// Validation errors use explicit variants
let err = SaraError::BrokenReference {
    from: sara_core::model::ItemId::new_unchecked("UC-001"),
    to: sara_core::model::ItemId::new_unchecked("SOL-999"),
};

// File operations with context
let err = SaraError::InvalidFrontmatter {
    file: PathBuf::from("doc.md"),
    reason: "Missing required 'id' field".to_string(),
};

Enums§

SaraError
Main error type for sara-core operations.

Type Aliases§

Result
Result type for sara-core operations.