Skip to content

Commit

Permalink
Merge pull request #42 from libsql/return-error-body
Browse files Browse the repository at this point in the history
return error body on error
  • Loading branch information
MarinPostma authored Aug 11, 2023
2 parents 8571b73 + b806ebe commit e1af376
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/reqwest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ impl HttpClient {
.send()
.await?;
if response.status() != reqwest::StatusCode::OK {
anyhow::bail!("{}", response.status());
let status = response.status();
let txt = response.text().await.unwrap_or_default();
anyhow::bail!("{status}: {txt}");
}
let resp: String = response.text().await?;
let response: pipeline::ServerMsg = serde_json::from_str(&resp)?;
Expand Down

0 comments on commit e1af376

Please sign in to comment.