Skip to main content

nika_init/
error.rs

1//! Error types for nika-init crate.
2
3/// Errors from the init/course/showcase subsystem.
4///
5/// Uses NIKA-500+ range to avoid collisions with nika-engine error codes.
6#[derive(Debug, thiserror::Error)]
7pub enum NikaInitError {
8    /// I/O error during file operations
9    #[error("[NIKA-501] I/O error: {0}")]
10    IoError(#[from] std::io::Error),
11
12    /// Configuration error — TOML parse/serialize failures
13    #[error("[NIKA-502] Config error: {reason}")]
14    ConfigError { reason: String },
15
16    /// Validation error — e.g. "course already exists"
17    #[error("[NIKA-503] Validation error: {reason}")]
18    ValidationError { reason: String },
19}
20
21/// Convenience Result alias.
22pub type Result<T> = std::result::Result<T, NikaInitError>;