Macroize various remaining Error constructions.

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk
2025-04-26 23:50:03 +00:00
parent 130f61d409
commit 72fd072026
8 changed files with 58 additions and 110 deletions

View File

@@ -1,11 +1,8 @@
use std::time::Duration;
use axum::extract::State;
use ruma::{
api::client::{account, error::ErrorKind},
authentication::TokenType,
};
use tuwunel_core::{Error, Result, utils};
use ruma::{api::client::account, authentication::TokenType};
use tuwunel_core::{Err, Result, utils};
use super::TOKEN_LENGTH;
use crate::Ruma;
@@ -22,14 +19,12 @@ pub(crate) async fn create_openid_token_route(
let sender_user = body.sender_user();
if sender_user != body.user_id {
return Err(Error::BadRequest(
ErrorKind::InvalidParam,
return Err!(Request(InvalidParam(
"Not allowed to request OpenID tokens on behalf of other users",
));
)));
}
let access_token = utils::random_string(TOKEN_LENGTH);
let expires_in = services
.users
.create_openid_token(&body.user_id, &access_token)?;