use crate::ode::*;
use std::fmt;
use std::error::Error;
#[derive(Debug)]
pub struct ODEError {
msg: String
}
impl ODEError {
pub fn no_key(k: String) -> ODEError {
ODEError{msg: format!("no key [{}] in mbgs", k)}
}
pub fn no_id(id: dBodyID) -> ODEError {
ODEError{msg: format!("no id {:018p} in obgs", id)}
}
pub fn no_mgm_id(id: dGeomID) -> ODEError {
ODEError{msg: format!("no mgm id {:018p} in mgms", id)}
}
}
impl fmt::Display for ODEError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "ODEError: {}", self.msg)
}
}
impl Error for ODEError {
fn source(&self) -> Option<&(dyn Error + 'static)> {
Some(self)
}
}