more custom message support for error type responses
This commit is contained in:
parent
5c20d30502
commit
972d79d44b
@ -10,20 +10,6 @@ use crate::{DBConn, schema, payload};
|
|||||||
use crate::err::{self, DbError};
|
use crate::err::{self, DbError};
|
||||||
|
|
||||||
|
|
||||||
macro_rules! busted_channels_response {
|
|
||||||
() => {
|
|
||||||
Json(vec![Channel {
|
|
||||||
id: -1,
|
|
||||||
name: "".to_string(),
|
|
||||||
permissions: 0,
|
|
||||||
limit: 0,
|
|
||||||
type_: 0, // the other fields are bs this is the only one that really mattesr
|
|
||||||
}])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// TODO: fix the return type of this to data thats verifiable
|
|
||||||
#[post("/create/<qname>/<perms>/<lim>/<ctype>")]
|
#[post("/create/<qname>/<perms>/<lim>/<ctype>")]
|
||||||
pub fn insert_new_channel(qname: String, perms: i32, lim: i32, ctype: i32, conn: DBConn) ->
|
pub fn insert_new_channel(qname: String, perms: i32, lim: i32, ctype: i32, conn: DBConn) ->
|
||||||
DbError<Json<payload::ChannelIndexed>, err::DbResponse> {
|
DbError<Json<payload::ChannelIndexed>, err::DbResponse> {
|
||||||
|
@ -6,7 +6,7 @@ use rocket::request::Request;
|
|||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct DbResponse {
|
pub struct DbResponse {
|
||||||
err_msg: &'static str
|
pub err_msg: &'static str
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type DbError<T, DbErr> = std::result::Result<T, DbErr>;
|
pub type DbError<T, DbErr> = std::result::Result<T, DbErr>;
|
||||||
|
Loading…
Reference in New Issue
Block a user