bit better error handling

This commit is contained in:
2021-05-19 20:13:00 +02:00
parent 204fe4d942
commit e5b77edeae
5 changed files with 75 additions and 22 deletions

View File

@ -7,7 +7,7 @@ use crate::error::*;
pub fn endpoint(endpoint: &str, input: serde_json::Value) -> Result<serde_json::Value, Error> {
match endpoint {
"echo" => Ok(serde_json::to_value(echo(serde_json::from_value(input)?))?),
_ => Err(Error::new(ErrorKind::InvalidEndpoint)),
_ => Err(Error::new(ErrorKind::InvalidEndpointError)),
}
}