fix: dont drop remote federation error on 4xx responses

for a very long time, if a remote server responded to us with
a valid but unsuccessful (HTTP 4xx) response and the caller was the
`send_federation_request` function, we may find ourselves
with a warning message only containing the destination's
server name which was very unhelpful. the true error was
buried away in trace logs. this would primarily be noticed
with server key fetch requests from us.

conduit has been throwing away the ruma request error: https://gitlab.com/famedly/conduit/-/blame/next/src/utils/error.rs#L62

before: 2024-05-23T04:45:02.930224Z  WARN router:{path=/_matrix/client/v3/publicRooms}:handle: conduit_api::client_server::directory: Failed to return our /publicRooms: matrix.org
after: 2024-05-23T05:05:02.435272Z  WARN router:{path=/_matrix/client/v3/publicRooms}:handle: conduit_api::client_server::directory: Failed to return our /publicRooms: matrix.org: [401 / M_UNAUTHORIZED] Failed to find any key to satisfy: _FetchKeyRequest(server_name='your.server.name', minimum_valid_until_ts=1716440702337, key_ids=['ed25519:RQB3XPQX'])

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-05-23 01:15:05 -04:00 committed by June 🍓🦴
parent d3db0ad4e2
commit 71bdcb958a

View file

@ -37,7 +37,7 @@ pub enum Error {
#[from]
source: rust_rocksdb::Error,
},
#[error("Could not generate an image.")]
#[error("Could not generate an image: {source}")]
Image {
#[from]
source: image::error::ImageError,
@ -52,14 +52,14 @@ pub enum Error {
#[from]
source: regex::Error,
},
#[error("{0}")]
#[error("Remote server {0} responded with: {1}")]
Federation(OwnedServerName, RumaError),
#[error("Could not do this io: {source}")]
Io {
#[from]
source: std::io::Error,
},
#[error("There was a problem with your configuration file: {0}")]
#[error("There was a problem with your configuration: {0}")]
BadConfig(String),
#[error("{0}")]
BadServerResponse(&'static str),