debug: add error message
This commit is contained in:
parent
97f2fab89d
commit
e659a0d212
1 changed files with 10 additions and 3 deletions
13
src/api.rs
13
src/api.rs
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue