venus_core/
error.rs

1//! Error types for venus-core.
2
3use thiserror::Error;
4
5/// Result type for venus-core operations.
6pub type Result<T> = std::result::Result<T, Error>;
7
8/// Errors that can occur in venus-core.
9#[derive(Debug, Error)]
10pub enum Error {
11    /// Failed to parse notebook source.
12    #[error("parse error: {0}")]
13    Parse(String),
14
15    /// Cyclic dependency detected in the cell graph.
16    #[error("cyclic dependency detected: {0}")]
17    CyclicDependency(String),
18
19    /// Cell not found.
20    #[error("cell not found: {0}")]
21    CellNotFound(String),
22
23    /// Compilation failed.
24    #[error("compilation failed{}: {message}", cell_id.as_ref().map(|id| format!(" for cell {}", id)).unwrap_or_default())]
25    Compilation {
26        cell_id: Option<String>,
27        message: String,
28    },
29
30    /// Failed to load dynamic library.
31    #[error("failed to load library: {0}")]
32    LibraryLoad(#[from] libloading::Error),
33
34    /// Serialization error.
35    #[error("serialization error: {0}")]
36    Serialization(String),
37
38    /// Deserialization error.
39    #[error("deserialization error: {0}")]
40    Deserialization(String),
41
42    /// Schema evolution error (incompatible type change).
43    #[error("schema evolution error: {0}")]
44    SchemaEvolution(String),
45
46    /// IO error.
47    #[error("IO error: {0}")]
48    Io(#[from] std::io::Error),
49
50    /// IPC communication error with worker process.
51    #[error("IPC error: {0}")]
52    Ipc(String),
53
54    /// Toolchain error.
55    #[error("toolchain error: {0}")]
56    Toolchain(String),
57
58    /// Execution error.
59    #[error("execution error: {0}")]
60    Execution(String),
61
62    /// Execution was aborted by user request.
63    #[error("execution aborted")]
64    Aborted,
65
66    /// Invalid operation (e.g., moving first cell up).
67    #[error("invalid operation: {0}")]
68    InvalidOperation(String),
69}