mirror of
https://github.com/girlbossceo/conduwuit.git
synced 2024-11-26 16:33:44 +00:00
dont panic when failing to create admin room response/PDU
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
712cdef6c7
commit
141a6bc73e
|
@ -84,9 +84,12 @@ fn main() {
|
|||
return;
|
||||
};
|
||||
|
||||
#[cfg(feature = "sentry_telemetry")]
|
||||
let _guard;
|
||||
|
||||
#[cfg(feature = "sentry_telemetry")]
|
||||
if config.sentry {
|
||||
let _guard = sentry::init((
|
||||
_guard = sentry::init((
|
||||
"https://fe2eb4536aa04949e28eff3128d64757@o4506996327251968.ingest.us.sentry.io/4506996334657536",
|
||||
sentry::ClientOptions {
|
||||
release: sentry::release_name!(),
|
||||
|
|
|
@ -24,7 +24,7 @@ use ruma::{
|
|||
};
|
||||
use serde_json::value::to_raw_value;
|
||||
use tokio::sync::{mpsc, Mutex};
|
||||
use tracing::warn;
|
||||
use tracing::{error, warn};
|
||||
|
||||
use super::pdu::PduBuilder;
|
||||
use crate::{
|
||||
|
@ -148,7 +148,7 @@ impl Service {
|
|||
message_content.relates_to = Some(Reply { in_reply_to: InReplyTo { event_id: reply.into() } });
|
||||
}
|
||||
|
||||
services().rooms.timeline.build_and_append_pdu(
|
||||
if let Err(e) = services().rooms.timeline.build_and_append_pdu(
|
||||
PduBuilder {
|
||||
event_type: TimelineEventType::RoomMessage,
|
||||
content: to_raw_value(&message_content)
|
||||
|
@ -160,7 +160,25 @@ impl Service {
|
|||
&conduit_user,
|
||||
&conduit_room,
|
||||
&state_lock)
|
||||
.await?;
|
||||
.await {
|
||||
error!("Failed to build and append admin room response PDU: \"{e}\"");
|
||||
|
||||
let error_room_message = RoomMessageEventContent::text_plain(format!("Failed to build and append admin room PDU: \"{e}\"\n\nThe original admin command may have finished successfully, but we could not return the output."));
|
||||
|
||||
services().rooms.timeline.build_and_append_pdu(
|
||||
PduBuilder {
|
||||
event_type: TimelineEventType::RoomMessage,
|
||||
content: to_raw_value(&error_room_message)
|
||||
.expect("event is valid, we just created it"),
|
||||
unsigned: None,
|
||||
state_key: None,
|
||||
redacts: None,
|
||||
},
|
||||
&conduit_user,
|
||||
&conduit_room,
|
||||
&state_lock)
|
||||
.await?;
|
||||
}
|
||||
|
||||
|
||||
drop(state_lock);
|
||||
|
|
Loading…
Reference in a new issue