debug: add error message

This commit is contained in:
Nathan 2025-09-12 19:22:25 +02:00
parent 97f2fab89d
commit e659a0d212

View file

@ -60,10 +60,17 @@ pub async fn post_upcoming_colles(
.header("Authorization", format!("Bearer {api_token}"))
.send()
.await?;
let status = response.status();
// Check if the response is successful
if !response.status().is_success() {
eprintln!("Failed to post upcoming colles: HTTP {}", response.status(),);
eprint!("Response: {:?}", response.text().await?);
if !status.is_success() {
let body = response.text().await?;
eprintln!("❌ Failed to post colle");
eprintln!(" → URL: {url}");
eprintln!(" → Status: {status}");
eprintln!(" → Request body: {colles_json}");
eprintln!(" → Response body: {body}");
return Err("Failed to post upcoming colles".into());
}