move http error class to router.rs

This commit is contained in:
Dietmar Maurer
2019-01-31 13:22:30 +01:00
parent b9903d6331
commit 5996577ab6
2 changed files with 26 additions and 26 deletions

View File

@ -6,7 +6,6 @@ use crate::auth_helpers::*;
use super::environment::RestEnvironment;
use super::formatter::*;
use std::fmt;
use std::path::{Path, PathBuf};
use std::sync::Arc;
use std::collections::HashMap;
@ -84,30 +83,6 @@ impl Service for ApiService {
}
}
#[derive(Debug, Fail)]
pub struct HttpError {
pub code: StatusCode,
pub message: String,
}
impl HttpError {
pub fn new(code: StatusCode, message: String) -> Self {
HttpError { code, message }
}
}
impl fmt::Display for HttpError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Error {}: {}", self.code, self.message)
}
}
macro_rules! http_err {
($status:ident, $msg:expr) => {{
Error::from(HttpError::new(StatusCode::$status, $msg))
}}
}
fn get_request_parameters_async(
info: &'static ApiMethod,
parts: Parts,