rename Error::Conflict to Error::AliasConflict

This is only used in one place.
This commit is contained in:
Olivia Lee 2024-12-14 15:52:13 -08:00
parent a2628357fd
commit ed7f7b2461
No known key found for this signature in database
GPG key ID: 54D568A15B9CD1F9
2 changed files with 4 additions and 5 deletions

View file

@ -44,7 +44,7 @@ pub(crate) async fn create_alias_route(
} }
if services().rooms.alias.resolve_local_alias(&body.room_alias)?.is_some() { if services().rooms.alias.resolve_local_alias(&body.room_alias)?.is_some() {
return Err(Error::Conflict("Alias already exists.")); return Err(Error::AliasConflict);
} }
services().rooms.alias.set_alias( services().rooms.alias.set_alias(

View file

@ -69,9 +69,8 @@ pub(crate) enum Error {
Uiaa(UiaaInfo), Uiaa(UiaaInfo),
#[error("{0}: {1}")] #[error("{0}: {1}")]
BadRequest(ErrorKind, &'static str), BadRequest(ErrorKind, &'static str),
// This is only needed for when a room alias already exists #[error("alias already exists")]
#[error("{0}")] AliasConflict,
Conflict(&'static str),
#[error("{0}")] #[error("{0}")]
Extension(#[from] axum::extract::rejection::ExtensionRejection), Extension(#[from] axum::extract::rejection::ExtensionRejection),
#[error("{0}")] #[error("{0}")]
@ -152,7 +151,7 @@ impl Error {
ErrorKind::UnsupportedRoomVersion, ErrorKind::UnsupportedRoomVersion,
StatusCode::INTERNAL_SERVER_ERROR, StatusCode::INTERNAL_SERVER_ERROR,
), ),
Self::Conflict(_) => (Unknown, StatusCode::CONFLICT), Self::AliasConflict => (Unknown, StatusCode::CONFLICT),
_ => (Unknown, StatusCode::INTERNAL_SERVER_ERROR), _ => (Unknown, StatusCode::INTERNAL_SERVER_ERROR),
}; };