reduce unnecessary logging on URL preview and event, use sensible error code for URL previews

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-08-11 11:08:26 -04:00 committed by Jason Volk
parent 52ccad04a6
commit 83ef4eecc7
3 changed files with 15 additions and 35 deletions

View file

@ -1,7 +1,7 @@
use std::{cmp::max, collections::BTreeMap};
use axum::extract::State;
use conduit::{debug_info, debug_warn};
use conduit::{debug_info, debug_warn, err};
use ruma::{
api::client::{
error::ErrorKind,
@ -475,10 +475,7 @@ pub(crate) async fn get_room_event_route(
.rooms
.timeline
.get_pdu(&body.event_id)?
.ok_or_else(|| {
warn!("Event not found, event ID: {:?}", &body.event_id);
Error::BadRequest(ErrorKind::NotFound, "Event not found.")
})?;
.ok_or_else(|| err!(Request(NotFound("Event {} not found.", &body.event_id))))?;
if !services
.rooms