code_executor/
error.rs

1pub type Result<T> = std::result::Result<T, Error>;
2
3#[derive(Debug, thiserror::Error)]
4pub enum Error {
5    #[error("Compilation error: {message}")]
6    Compilation { message: String },
7
8    #[error("IO error: {0}")]
9    IO(#[from] std::io::Error),
10
11    #[error("Failed to create cgroup: {0}")]
12    Cgroup(#[from] cgroups_rs::error::Error),
13}
14
15impl From<std::string::FromUtf8Error> for Error {
16    fn from(error: std::string::FromUtf8Error) -> Self {
17        Error::IO(std::io::Error::other(error))
18    }
19}