Removal of unused code or things that were trivial to switch to the library like db types

This commit is contained in:
shockrah
2020-11-02 00:11:15 -08:00
parent 4cb8f578ed
commit 06c81ce2f2
3 changed files with 0 additions and 61 deletions

View File

@@ -1,38 +0,0 @@
use mysql_async::error::ServerError;
use hyper::{Body, Response, StatusCode};
use serde::Serialize;
use serde_json::to_string as json;
#[derive(Serialize)]
struct GenericErrData {
status: u16,
message: &'static str,
note: &'static str,
}
pub fn db_err_response_body(response: &mut Response<Body>, err: ServerError) {
*response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
match err.code {
// Duplicate unique value was (tried to be) inserted
1062 => {
let s = json(&GenericErrData {
status: 1062,
message: "Duplicate key was inserted and failed",
note: "Check parameters given"
}).unwrap();
*response.body_mut() = Body::from(s);
},
// Generic errors
_ => {
let s = json(&GenericErrData{
status: 500,
message: "Generic Backend error",
note:""
}).unwrap();
*response.body_mut() = Body::from(s);
}
}
}

View File

@@ -36,7 +36,6 @@ mod admin;
mod http_params;
mod db_types;
mod common;
mod testing;
const NO_ERR: u16 = 0;