1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use crate::job::{JobResult, JobStatus};
#[derive(Debug, PartialEq)]
pub enum MessageError {
RuntimeError(String),
ParameterValueError(String),
ProcessingError(JobResult),
RequirementsError(String),
NotImplemented(),
}
impl MessageError {
pub fn from(error: std::io::Error, job_result: JobResult) -> Self {
let result = job_result
.with_status(JobStatus::Error)
.with_message(&format!("IO Error: {}", error.to_string()));
MessageError::ProcessingError(result)
}
}
pub type Result<T> = std::result::Result<T, MessageError>;