Skip to content

Commit

Permalink
libsql: improve hrana api error message
Browse files Browse the repository at this point in the history
  • Loading branch information
LucioFranco committed Dec 2, 2024
1 parent 9241b00 commit d568c4a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions libsql/src/hrana/hyper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,13 @@ impl HttpSender {

let resp = self.inner.request(req).await.map_err(HranaError::from)?;

if resp.status() != StatusCode::OK {
let status = resp.status();
if status != StatusCode::OK {
let body = hyper::body::to_bytes(resp.into_body())
.await
.map_err(HranaError::from)?;
let body = String::from_utf8(body.into()).unwrap();
return Err(HranaError::Api(body));
return Err(HranaError::Api(format!("status={}, body={}", status, body)));
}

let body: super::HttpBody<ByteStream> = if resp.is_end_stream() {
Expand Down

0 comments on commit d568c4a

Please sign in to comment.