replace ErrorKind::Forbidden
with forbidden()
non-exhaustive constructor
917584e0ca
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
13cd9c4c38
commit
ddcf43f1b8
21 changed files with 75 additions and 73 deletions
|
@ -131,7 +131,7 @@ impl Service {
|
|||
match services().rooms.timeline.get_pdu(&event_id) {
|
||||
Ok(Some(pdu)) => {
|
||||
if pdu.room_id != room_id {
|
||||
return Err(Error::BadRequest(ErrorKind::Forbidden, "Evil event in db"));
|
||||
return Err(Error::BadRequest(ErrorKind::forbidden(), "Evil event in db"));
|
||||
}
|
||||
for auth_event in &pdu.auth_events {
|
||||
let sauthevent = services()
|
||||
|
|
|
@ -94,7 +94,7 @@ impl Service {
|
|||
event ID {event_id}"
|
||||
);
|
||||
return Err(Error::BadRequest(
|
||||
ErrorKind::Forbidden,
|
||||
ErrorKind::forbidden(),
|
||||
"Federation of this room is currently disabled on this server.",
|
||||
));
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ impl Service {
|
|||
event ID {event_id}"
|
||||
);
|
||||
return Err(Error::BadRequest(
|
||||
ErrorKind::Forbidden,
|
||||
ErrorKind::forbidden(),
|
||||
"Federation of this room is currently disabled on this server.",
|
||||
));
|
||||
}
|
||||
|
@ -1645,7 +1645,7 @@ impl Service {
|
|||
Ok(())
|
||||
} else {
|
||||
info!("Server {} was denied by room ACL in {}", server_name, room_id);
|
||||
Err(Error::BadRequest(ErrorKind::Forbidden, "Server was denied by room ACL"))
|
||||
Err(Error::BadRequest(ErrorKind::forbidden(), "Server was denied by room ACL"))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -549,7 +549,7 @@ impl Service {
|
|||
if !is_accessable_child(current_room, &join_rule.clone().into(), identifier, &allowed_room_ids)? {
|
||||
debug!("User is not allowed to see room {room_id}");
|
||||
// This error will be caught later
|
||||
return Err(Error::BadRequest(ErrorKind::Forbidden, "User is not allowed to see the room"));
|
||||
return Err(Error::BadRequest(ErrorKind::forbidden(), "User is not allowed to see the room"));
|
||||
}
|
||||
|
||||
let join_rule = join_rule.into();
|
||||
|
@ -698,9 +698,9 @@ impl Service {
|
|||
})
|
||||
},
|
||||
Some(SummaryAccessibility::Inaccessible) => {
|
||||
Err(Error::BadRequest(ErrorKind::Forbidden, "The requested room is inaccessible"))
|
||||
Err(Error::BadRequest(ErrorKind::forbidden(), "The requested room is inaccessible"))
|
||||
},
|
||||
None => Err(Error::BadRequest(ErrorKind::Forbidden, "The requested room was not found")),
|
||||
None => Err(Error::BadRequest(ErrorKind::forbidden(), "The requested room was not found")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -755,7 +755,7 @@ impl Service {
|
|||
})?;
|
||||
|
||||
if !auth_check {
|
||||
return Err(Error::BadRequest(ErrorKind::Forbidden, "Event is not authorized."));
|
||||
return Err(Error::BadRequest(ErrorKind::forbidden(), "Event is not authorized."));
|
||||
}
|
||||
|
||||
// Hash and sign
|
||||
|
@ -835,7 +835,7 @@ impl Service {
|
|||
TimelineEventType::RoomEncryption => {
|
||||
warn!("Encryption is not allowed in the admins room");
|
||||
return Err(Error::BadRequest(
|
||||
ErrorKind::Forbidden,
|
||||
ErrorKind::forbidden(),
|
||||
"Encryption is not allowed in the admins room.",
|
||||
));
|
||||
},
|
||||
|
@ -858,7 +858,7 @@ impl Service {
|
|||
if target == server_user {
|
||||
warn!("Conduit user cannot leave from admins room");
|
||||
return Err(Error::BadRequest(
|
||||
ErrorKind::Forbidden,
|
||||
ErrorKind::forbidden(),
|
||||
"Conduit user cannot leave from admins room.",
|
||||
));
|
||||
}
|
||||
|
@ -874,7 +874,7 @@ impl Service {
|
|||
if count < 2 {
|
||||
warn!("Last admin cannot leave from admins room");
|
||||
return Err(Error::BadRequest(
|
||||
ErrorKind::Forbidden,
|
||||
ErrorKind::forbidden(),
|
||||
"Last admin cannot leave from admins room.",
|
||||
));
|
||||
}
|
||||
|
@ -884,7 +884,7 @@ impl Service {
|
|||
if target == server_user {
|
||||
warn!("Conduit user cannot be banned in admins room");
|
||||
return Err(Error::BadRequest(
|
||||
ErrorKind::Forbidden,
|
||||
ErrorKind::forbidden(),
|
||||
"Conduit user cannot be banned in admins room.",
|
||||
));
|
||||
}
|
||||
|
@ -900,7 +900,7 @@ impl Service {
|
|||
if count < 2 {
|
||||
warn!("Last admin cannot be banned in admins room");
|
||||
return Err(Error::BadRequest(
|
||||
ErrorKind::Forbidden,
|
||||
ErrorKind::forbidden(),
|
||||
"Last admin cannot be banned in admins room.",
|
||||
));
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ impl Service {
|
|||
|
||||
if !hash_matches {
|
||||
uiaainfo.auth_error = Some(ruma::api::client::error::StandardErrorBody {
|
||||
kind: ErrorKind::Forbidden,
|
||||
kind: ErrorKind::forbidden(),
|
||||
message: "Invalid username or password.".to_owned(),
|
||||
});
|
||||
return Ok((false, uiaainfo));
|
||||
|
@ -91,7 +91,7 @@ impl Service {
|
|||
uiaainfo.completed.push(AuthType::RegistrationToken);
|
||||
} else {
|
||||
uiaainfo.auth_error = Some(ruma::api::client::error::StandardErrorBody {
|
||||
kind: ErrorKind::Forbidden,
|
||||
kind: ErrorKind::forbidden(),
|
||||
message: "Invalid registration token.".to_owned(),
|
||||
});
|
||||
return Ok((false, uiaainfo));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue