Add an error log if 2FA can't be enabled #7

open
opened by mackuba.eu targeting main from mackuba.eu/pds-gatekeeper: 2fa_error_log

Currently, if INSERT INTO two_factor_accounts fails (e.g. in my case, because the gatekeeper sqlite file wasn't writable), Gatekeeper just returns a 400 response with no content, but it doesn't return or log any errors that would indicate what exactly is going on.

Changed files
+4 -1
src
+4 -1
src/xrpc/com_atproto_server.rs
··· 233 233 .bind(&did_row.0) 234 234 .execute(&state.pds_gatekeeper_pool) 235 235 .await 236 - .map_err(|_| StatusCode::BAD_REQUEST)?; 236 + .map_err(|err| { 237 + log::error!("Error enabling 2FA: {err}"); 238 + StatusCode::BAD_REQUEST 239 + })?; 237 240 238 241 Ok(StatusCode::OK.into_response()) 239 242 }