Skip to content

plissken-core::error

Rust

Unified error types for plissken-core.

This module provides a single error enum that covers all error cases in the library, replacing the previous mix of anyhow::Error, tera::Error, and other error types.

pub

The primary error type for plissken-core operations.

This enum covers all error categories that can occur during parsing, rendering, and configuration handling.

  • ConfigNotFound - Configuration file not found at the expected path.
  • ConfigParse - Failed to parse configuration file.
  • ConfigValidation - Configuration validation failed.
  • Parse - Failed to parse a source file.
  • FileRead - Failed to read a source file.
  • Template - Template rendering failed.
  • OutputWrite - Failed to write output file.
  • CrossRef - Cross-reference resolution failed.
  • Io - Generic IO error with context.
  • Discovery - Module discovery failed.
  • ManifestParse - Failed to parse manifest file (Cargo.toml or pyproject.toml).

pub

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

Create a parse error for a Rust file.

Source
pub fn rust_parse(path: impl Into<PathBuf>, message: impl Into<String>) -> Self {
PlisskenError::Parse {
language: "Rust".into(),
path: path.into(),
line: None,
message: message.into(),
}
}

pub

fn rust_parse_at(
path: impl Into<PathBuf>,
line: usize,
message: impl Into<String>,
) -> Self

Create a parse error for a Rust file with line number.

Source
pub fn rust_parse_at(
path: impl Into<PathBuf>,
line: usize,
message: impl Into<String>,
) -> Self {
PlisskenError::Parse {
language: "Rust".into(),
path: path.into(),
line: Some(line),
message: message.into(),
}
}

pub

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

Create a parse error for a Python file.

Source
pub fn python_parse(path: impl Into<PathBuf>, message: impl Into<String>) -> Self {
PlisskenError::Parse {
language: "Python".into(),
path: path.into(),
line: None,
message: message.into(),
}
}

pub

fn python_parse_at(
path: impl Into<PathBuf>,
line: usize,
message: impl Into<String>,
) -> Self

Create a parse error for a Python file with line number.

Source
pub fn python_parse_at(
path: impl Into<PathBuf>,
line: usize,
message: impl Into<String>,
) -> Self {
PlisskenError::Parse {
language: "Python".into(),
path: path.into(),
line: Some(line),
message: message.into(),
}
}

pub

fn file_read(path: impl Into<PathBuf>, source: std::io::Error) -> Self

Create a file read error.

Source
pub fn file_read(path: impl Into<PathBuf>, source: std::io::Error) -> Self {
let path = path.into();
PlisskenError::FileRead {
message: source.to_string(),
path,
source,
}
}

pub

fn io(context: impl Into<String>, source: std::io::Error) -> Self

Create an IO error with context.

Source
pub fn io(context: impl Into<String>, source: std::io::Error) -> Self {
PlisskenError::Io {
context: context.into(),
source,
}
}

pub

fn config_not_found(path: impl Into<PathBuf>) -> Self

Create a config not found error.

Source
pub fn config_not_found(path: impl Into<PathBuf>) -> Self {
PlisskenError::ConfigNotFound { path: path.into() }
}

pub

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

Create a discovery error.

Source
pub fn discovery(path: impl Into<PathBuf>, message: impl Into<String>) -> Self {
PlisskenError::Discovery {
path: path.into(),
message: message.into(),
}
}
Name Type Description
Result<T> std::result::Result<T, PlisskenError> A specialized Result type for plissken operations.