mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-09-11 02:52:50 +02:00
Macroize various remaining Error constructions.
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
21bbee8e3c
commit
667afedd24
9 changed files with 78 additions and 125 deletions
|
@ -2,7 +2,7 @@ use std::collections::BTreeMap;
|
|||
|
||||
use axum::extract::State;
|
||||
use conduwuit::{
|
||||
Err, Error, Result,
|
||||
Err, Result,
|
||||
matrix::pdu::PduBuilder,
|
||||
utils::{IterStream, stream::TryIgnore},
|
||||
warn,
|
||||
|
@ -12,11 +12,8 @@ use futures::{StreamExt, TryStreamExt, future::join3};
|
|||
use ruma::{
|
||||
OwnedMxcUri, OwnedRoomId, UserId,
|
||||
api::{
|
||||
client::{
|
||||
error::ErrorKind,
|
||||
profile::{
|
||||
get_avatar_url, get_display_name, get_profile, set_avatar_url, set_display_name,
|
||||
},
|
||||
client::profile::{
|
||||
get_avatar_url, get_display_name, get_profile, set_avatar_url, set_display_name,
|
||||
},
|
||||
federation,
|
||||
},
|
||||
|
@ -110,7 +107,7 @@ pub(crate) async fn get_displayname_route(
|
|||
if !services.users.exists(&body.user_id).await {
|
||||
// Return 404 if this user doesn't exist and we couldn't fetch it over
|
||||
// federation
|
||||
return Err(Error::BadRequest(ErrorKind::NotFound, "Profile was not found."));
|
||||
return Err!(Request(NotFound("Profile was not found.")));
|
||||
}
|
||||
|
||||
Ok(get_display_name::v3::Response {
|
||||
|
@ -214,7 +211,7 @@ pub(crate) async fn get_avatar_url_route(
|
|||
if !services.users.exists(&body.user_id).await {
|
||||
// Return 404 if this user doesn't exist and we couldn't fetch it over
|
||||
// federation
|
||||
return Err(Error::BadRequest(ErrorKind::NotFound, "Profile was not found."));
|
||||
return Err!(Request(NotFound("Profile was not found.")));
|
||||
}
|
||||
|
||||
Ok(get_avatar_url::v3::Response {
|
||||
|
@ -287,7 +284,7 @@ pub(crate) async fn get_profile_route(
|
|||
if !services.users.exists(&body.user_id).await {
|
||||
// Return 404 if this user doesn't exist and we couldn't fetch it over
|
||||
// federation
|
||||
return Err(Error::BadRequest(ErrorKind::NotFound, "Profile was not found."));
|
||||
return Err!(Request(NotFound("Profile was not found.")));
|
||||
}
|
||||
|
||||
let mut custom_profile_fields: BTreeMap<String, serde_json::Value> = services
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue