basiliq 0.1.2

REST API server exposing a Postgres database using JSON:API
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use super::*;

/// Handle [hyper error](hyper::Error) returning a HTTP error response
pub fn handle_http_error<'a>(err: hyper::Error) -> (hyper::StatusCode, CibouletteErrorObj<'a>) {
    (
        hyper::StatusCode::INTERNAL_SERVER_ERROR,
        CibouletteErrorObj {
            id: Some(Cow::Borrowed(BasiliqErrorId::HttpError.id())),
            title: Some(Cow::Borrowed(BasiliqErrorId::HttpError.title())),
            detail: Some(err.to_string().into()),
            ..Default::default()
        },
    )
}