mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-16 23:31:24 +01:00
propagate error code from federation response errors
Previously we were propagating the status code, but always returning M_UNKNOWN regardless of the remote error code. This seems kinda pointless, so just propagate both. We can also stop special-casing the message now that the display impl is reasonable.
This commit is contained in:
parent
45be146c14
commit
165ff0b50c
1 changed files with 5 additions and 9 deletions
|
|
@ -99,15 +99,6 @@ impl Error {
|
||||||
return Ra(UiaaResponse::AuthResponse(uiaainfo.clone()));
|
return Ra(UiaaResponse::AuthResponse(uiaainfo.clone()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Self::Federation(origin, error) = self {
|
|
||||||
let mut error = error.clone();
|
|
||||||
error.body = ErrorBody::Standard {
|
|
||||||
kind: Unknown,
|
|
||||||
message: format!("Answer from {origin}: {error}"),
|
|
||||||
};
|
|
||||||
return Ra(UiaaResponse::MatrixError(error));
|
|
||||||
}
|
|
||||||
|
|
||||||
let message = format!("{}", self.display_with_sources(" -> "));
|
let message = format!("{}", self.display_with_sources(" -> "));
|
||||||
|
|
||||||
let (kind, status_code) = match self {
|
let (kind, status_code) = match self {
|
||||||
|
|
@ -138,6 +129,11 @@ impl Error {
|
||||||
_ => StatusCode::BAD_REQUEST,
|
_ => StatusCode::BAD_REQUEST,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
// Propagate the status code and error code from the remote response
|
||||||
|
Self::Federation(_, error) => (
|
||||||
|
error.error_kind().cloned().unwrap_or(Unknown),
|
||||||
|
error.status_code,
|
||||||
|
),
|
||||||
Self::UnsupportedRoomVersion(_) => (
|
Self::UnsupportedRoomVersion(_) => (
|
||||||
ErrorKind::UnsupportedRoomVersion,
|
ErrorKind::UnsupportedRoomVersion,
|
||||||
StatusCode::INTERNAL_SERVER_ERROR,
|
StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue