Skip to main content

memlink_runtime/
error.rs

1//! Error types for the memlink runtime.
2
3use std::path::PathBuf;
4use thiserror::Error;
5
6#[derive(Error, Debug, Clone)]
7pub enum Error {
8    #[error("Module file not found: {0}")]
9    FileNotFound(PathBuf),
10
11    #[error("Invalid module format: {0}")]
12    InvalidModuleFormat(String),
13
14    #[error("Unsupported module reference format")]
15    UnsupportedReference,
16
17    #[error("Registry-based module resolution is not implemented")]
18    RegistryNotImplemented,
19
20    #[error("No resolver found that can handle the module reference")]
21    NoResolverFound,
22
23    #[error("This resolver cannot handle the request; delegation intended")]
24    NotOurs,
25
26    #[error("Failed to load shared library: {0}")]
27    LibraryLoadFailed(String),
28
29    #[error("Symbol not found: {0}")]
30    SymbolNotFound(String),
31
32    #[error("Module call failed with error code: {0}")]
33    ModuleCallFailed(i32),
34
35    #[error("Module panicked: {0}")]
36    ModulePanicked(String),
37
38    #[error("Reload timed out waiting for {0} in-flight calls to complete")]
39    ReloadTimeout(usize),
40
41    #[error("Reload already in progress for module {0}")]
42    ReloadInProgress(u64),
43}
44
45pub type Result<T> = std::result::Result<T, Error>;