stop sending make_join if 15 servers responded with unsupported/invalid room version
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
ce414023a4
commit
af6c72fa84
2 changed files with 47 additions and 4 deletions
|
@ -101,7 +101,7 @@ impl Error {
|
|||
if let Self::FederationError(origin, error) = self {
|
||||
let mut error = error.clone();
|
||||
error.body = ErrorBody::Standard {
|
||||
kind: Unknown,
|
||||
kind: error.error_kind().unwrap_or(&Unknown).clone(),
|
||||
message: format!("Answer from {origin}: {error}"),
|
||||
};
|
||||
return RumaResponse(UiaaResponse::MatrixError(error));
|
||||
|
@ -138,7 +138,7 @@ impl Error {
|
|||
_ => (Unknown, StatusCode::INTERNAL_SERVER_ERROR),
|
||||
};
|
||||
|
||||
info!("Returning an error: {}: {}", status_code, message);
|
||||
info!("Returning an error: {status_code}: {message}");
|
||||
|
||||
RumaResponse(UiaaResponse::MatrixError(RumaError {
|
||||
body: ErrorBody::Standard {
|
||||
|
@ -149,6 +149,18 @@ impl Error {
|
|||
}))
|
||||
}
|
||||
|
||||
/// Returns the Matrix error code / error kind
|
||||
pub fn error_code(&self) -> ErrorKind {
|
||||
if let Self::FederationError(_, error) = self {
|
||||
return error.error_kind().unwrap_or(&Unknown).clone();
|
||||
}
|
||||
|
||||
match self {
|
||||
Self::BadRequest(kind, _) => kind.clone(),
|
||||
_ => Unknown,
|
||||
}
|
||||
}
|
||||
|
||||
/// Sanitizes public-facing errors that can leak sensitive information.
|
||||
pub fn sanitized_error(&self) -> String {
|
||||
let db_error = String::from("Database or I/O error occurred.");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue