Skip to content
Snippets Groups Projects
Commit c401663c authored by insert's avatar insert
Browse files

Catch database error for send message.

parent 3d3db80e
No related merge requests found
Pipeline #480 passed with stage
in 2 minutes and 50 seconds
use crate::{database::*, notifications::events::ClientboundNotification, util::result::Result}; use crate::{database::*, notifications::events::ClientboundNotification, util::result::{Error, Result}};
use mongodb::bson::{DateTime, to_bson}; use mongodb::bson::{DateTime, to_bson};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
...@@ -43,7 +43,8 @@ impl Message { ...@@ -43,7 +43,8 @@ impl Message {
to_bson(&self).unwrap().as_document().unwrap().clone(), to_bson(&self).unwrap().as_document().unwrap().clone(),
None None
) )
.await; .await
.map_err(|_| Error::DatabaseError { operation: "insert_one", with: "messages" })?;
let channel = self.channel.clone(); let channel = self.channel.clone();
ClientboundNotification::Message(self) ClientboundNotification::Message(self)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment