fix: surface server error in get_status and trim table output
- Include error field in get_status() ApiResponse so server error messages are surfaced instead of generic 'No status data returned' - Use trim_lines_end() on table output to match local mode formatting
This commit is contained in:
@@ -227,11 +227,17 @@ impl KeepClient {
|
||||
#[derive(serde::Deserialize)]
|
||||
struct ApiResponse {
|
||||
data: Option<crate::common::status::StatusInfo>,
|
||||
error: Option<String>,
|
||||
}
|
||||
let response: ApiResponse = self.get_json("/api/status")?;
|
||||
response
|
||||
.data
|
||||
.ok_or_else(|| CoreError::Other(anyhow::anyhow!("No status data returned")))
|
||||
response.data.ok_or_else(|| {
|
||||
CoreError::Other(anyhow::anyhow!(
|
||||
"{}",
|
||||
response
|
||||
.error
|
||||
.unwrap_or_else(|| "No status data returned".to_string())
|
||||
))
|
||||
})
|
||||
}
|
||||
|
||||
pub fn get_item_info(&self, id: i64) -> Result<ItemInfo, CoreError> {
|
||||
|
||||
Reference in New Issue
Block a user