* api::channels::list_channels has more relevant docs

Better matching against return types so we're not throwing away errors
	This just entails swapping the if let for a match statement

* db-lib::Message::send has more updated docs on what variants of Response it returns

* api::messages::send_message has better error logging now and more relevant comments
This commit is contained in:
shockrah
2021-04-21 17:14:33 -07:00
parent ef73b39f4f
commit c4d7eb9111
3 changed files with 25 additions and 18 deletions

View File

@@ -65,7 +65,7 @@ impl Message {
if let Ok(_) = file.write_all(data).await {
Response::Row(msg)
} else {
Response::Empty
Response::Other(format!("Couldn't write data to disk"))
}
}
Err(e) => {
@@ -77,6 +77,8 @@ impl Message {
pub async fn send(p: &Pool, content: &str, content_type: &str, cid: UBigInt, uid: UBigInt) -> Result<Response<Self>, SqlError> {
//! @returns on_sucess -> Ok(Response::Row<Message>)
//! @returns on_user_fail -> Ok(Response::RestrictedInput)
//! @returns on_caught_server_fail -> Ok(Response::Other)
//! @returns on_failure Err(SqlErr)
if content_type == "text/plain" {
match Self::insert_text(p, content, cid, uid).await {