}
impl<'r> Responder<'r> for SolveError {
fn respond_to(self, _request: &rocket::Request) -> rocket::response::Result<'r> {
let mut response = Response::new();
match self {
SolveError::TimeExceeded => {
let status = Status::new(599, "Max solve time exceeded");
response.set_status(status);
response.set_sized_body(Cursor::new("Max solve time exceeded"));
}
SolveError::NoSolution => {
let status = Status::new(598, "No solution found");
response.set_status(status);
response.set_sized_body(Cursor::new("No solution found"));
}
SolveError::ClingoError(_why) => {
let status = Status::new(597, "Internal clingo error");
response.set_status(status);
response.set_sized_body(Cursor::new("Internal clingo error"));
}
};
Ok(response)
}