pop_fork/error/
executor.rs1use smoldot::executor::{host, runtime_call};
6use thiserror::Error;
7
8#[derive(Debug, Error)]
10pub enum ExecutorError {
11 #[error("Failed to create VM prototype: {message}")]
13 PrototypeCreation {
14 message: String,
16 },
17
18 #[error("Failed to start runtime call `{method}`: {message}")]
20 StartError {
21 method: String,
23 message: String,
25 },
26
27 #[error("Runtime execution error in `{method}`: {message}")]
29 RuntimeError {
30 method: String,
32 message: String,
34 },
35
36 #[error("Storage operation failed for key {key}: {message}")]
38 StorageError {
39 key: String,
41 message: String,
43 },
44
45 #[error("Invalid heap pages value: {message}")]
47 InvalidHeapPages {
48 message: String,
50 },
51}
52
53impl From<host::NewErr> for ExecutorError {
54 fn from(err: host::NewErr) -> Self {
55 ExecutorError::PrototypeCreation { message: err.to_string() }
56 }
57}
58
59impl From<runtime_call::Error> for ExecutorError {
60 fn from(err: runtime_call::Error) -> Self {
61 ExecutorError::RuntimeError { method: String::new(), message: err.to_string() }
62 }
63}
64
65impl From<runtime_call::ErrorDetail> for ExecutorError {
66 fn from(err: runtime_call::ErrorDetail) -> Self {
67 ExecutorError::RuntimeError { method: String::new(), message: err.to_string() }
68 }
69}