Fix server error messages

This commit is contained in:
DecDuck
2025-11-30 23:12:16 +11:00
parent 28d7a741c1
commit f41df6531c
6 changed files with 21 additions and 12 deletions
+5 -5
View File
@@ -80,7 +80,7 @@ pub async fn fetch_user() -> Result<User, RemoteAccessError> {
let err: DropServerError = response.json().await?;
warn!("{err:?}");
if err.status_message == "Nonce expired" {
if err.message == "Nonce expired" {
return Err(RemoteAccessError::OutOfSync);
}
@@ -106,8 +106,8 @@ pub fn auth_initiate_logic(mode: String) -> Result<String, RemoteAccessError> {
name: format!("{} (Desktop)", hostname.display()),
platform: env::consts::OS.to_string(),
capabilities: HashMap::from([
("peerAPI".to_owned(), CapabilityConfiguration {}),
("cloudSaves".to_owned(), CapabilityConfiguration {}),
("PeerAPI".to_owned(), CapabilityConfiguration {}),
("CloudSaves".to_owned(), CapabilityConfiguration {}),
]),
mode,
};
@@ -117,9 +117,9 @@ pub fn auth_initiate_logic(mode: String) -> Result<String, RemoteAccessError> {
if response.status() != 200 {
let data: DropServerError = response.json()?;
error!("could not start handshake: {}", data.status_message);
error!("could not start handshake: {:?}", data);
return Err(RemoteAccessError::HandshakeFailed(data.status_message));
return Err(RemoteAccessError::HandshakeFailed(data.message));
}
let response = response.text()?;
+2 -2
View File
@@ -15,7 +15,7 @@ use serde::Deserialize;
pub struct DropServerError {
pub status_code: usize,
pub status_message: String,
// pub message: String,
pub message: String,
// pub url: String,
}
@@ -76,7 +76,7 @@ impl Display for RemoteAccessError {
RemoteAccessError::InvalidResponse(error) => write!(
f,
"server returned an invalid response: {}, {}",
error.status_code, error.status_message
error.status_code, error.message
),
RemoteAccessError::UnparseableResponse(error) => {
write!(f, "server returned an invalid response: {error}")