add settings routes errors

This commit is contained in:
mpostma 2021-02-23 19:46:18 +01:00
parent af2cbd0258
commit ac89c35edc
No known key found for this signature in database
GPG Key ID: CBC8A7C1D7A28C3A

View File

@ -1,5 +1,4 @@
use actix_web::{web, HttpResponse, delete, get, post}; use actix_web::{web, HttpResponse, delete, get, post};
use log::error;
use crate::Data; use crate::Data;
use crate::error::ResponseError; use crate::error::ResponseError;
@ -33,8 +32,7 @@ macro_rules! make_setting_route {
Ok(HttpResponse::Ok().body(json)) Ok(HttpResponse::Ok().body(json))
} }
Err(e) => { Err(e) => {
log::error!("{}", e); Ok(HttpResponse::BadRequest().body(serde_json::json!({ "error": e.to_string() })))
unimplemented!();
} }
} }
} }
@ -56,8 +54,7 @@ macro_rules! make_setting_route {
Ok(HttpResponse::Ok().body(json)) Ok(HttpResponse::Ok().body(json))
} }
Err(e) => { Err(e) => {
log::error!("{}", e); Ok(HttpResponse::BadRequest().body(serde_json::json!({ "error": e.to_string() })))
unimplemented!();
} }
} }
} }
@ -74,8 +71,7 @@ macro_rules! make_setting_route {
Ok(HttpResponse::Ok().body(json)) Ok(HttpResponse::Ok().body(json))
} }
Err(e) => { Err(e) => {
log::error!("{}", e); Ok(HttpResponse::BadRequest().body(serde_json::json!({ "error": e.to_string() })))
unimplemented!();
} }
} }
} }
@ -147,8 +143,7 @@ async fn update_all(
Ok(HttpResponse::Ok().body(json)) Ok(HttpResponse::Ok().body(json))
} }
Err(e) => { Err(e) => {
error!("{}", e); Ok(HttpResponse::BadRequest().body(serde_json::json!({ "error": e.to_string() })))
unimplemented!();
} }
} }
} }
@ -164,8 +159,7 @@ async fn get_all(
Ok(HttpResponse::Ok().body(json)) Ok(HttpResponse::Ok().body(json))
} }
Err(e) => { Err(e) => {
error!("{}", e); Ok(HttpResponse::BadRequest().body(serde_json::json!({ "error": e.to_string() })))
unimplemented!();
} }
} }
} }
@ -182,8 +176,7 @@ async fn delete_all(
Ok(HttpResponse::Ok().body(json)) Ok(HttpResponse::Ok().body(json))
} }
Err(e) => { Err(e) => {
error!("{}", e); Ok(HttpResponse::BadRequest().body(serde_json::json!({ "error": e.to_string() })))
unimplemented!();
} }
} }
} }