1use snafu::Snafu;
4
5pub type Result<T, E = Error> = std::result::Result<T, E>;
7
8#[derive(Debug, Snafu)]
10#[snafu(visibility(pub))]
11pub enum Error {
12 #[snafu(display("Codegen error: {source}"))]
14 Codegen { source: svod_codegen::Error },
15
16 #[snafu(display("JIT compilation failed: {reason}"))]
18 JitCompilation { reason: String },
19
20 #[snafu(display("Function '{name}' not found in module"))]
22 FunctionNotFound { name: String },
23
24 #[snafu(display("Buffer allocation failed: {reason}"))]
26 BufferAllocation { reason: String },
27
28 #[snafu(display("Invalid buffer size: {size}"))]
30 InvalidBufferSize { size: usize },
31
32 #[snafu(display("Execution error: {reason}"))]
34 Execution { reason: String },
35
36 #[snafu(display("LLVM error: {reason}"))]
38 LlvmError { reason: String },
39
40 #[snafu(display("Unsupported device type: {device}"))]
42 UnsupportedDevice { device: String },
43
44 #[snafu(display("Unsupported runtime feature {kind}: {reason}"))]
46 Unsupported { kind: String, reason: String },
47
48 #[snafu(display("Device error: {source}"))]
50 Device { source: svod_device::Error },
51}
52
53impl From<svod_device::Error> for Error {
54 fn from(source: svod_device::Error) -> Self {
55 Error::Device { source }
56 }
57}