feat(paheko): print error details
This commit is contained in:
parent
bbea78cea3
commit
978c00c1dc
1 changed files with 9 additions and 0 deletions
|
@ -285,6 +285,7 @@ impl AuthentifiedClient {
|
||||||
.json(&payload)
|
.json(&payload)
|
||||||
.send().await?;
|
.send().await?;
|
||||||
if res.status() != 200 {
|
if res.status() != 200 {
|
||||||
|
self.show_paheko_err(res).await;
|
||||||
return Err(APIClientError::InvalidStatusCode.into());
|
return Err(APIClientError::InvalidStatusCode.into());
|
||||||
}
|
}
|
||||||
res.json().await.context("Sql query")
|
res.json().await.context("Sql query")
|
||||||
|
@ -337,6 +338,7 @@ impl AuthentifiedClient {
|
||||||
.get(path)
|
.get(path)
|
||||||
.send().await?;
|
.send().await?;
|
||||||
if res.status() != 200 {
|
if res.status() != 200 {
|
||||||
|
self.show_paheko_err(res).await;
|
||||||
return Err(APIClientError::InvalidStatusCode.into());
|
return Err(APIClientError::InvalidStatusCode.into());
|
||||||
}
|
}
|
||||||
res.json().await.context("Get accounting years")
|
res.json().await.context("Get accounting years")
|
||||||
|
@ -428,6 +430,7 @@ impl AuthentifiedClient {
|
||||||
.send().await?;
|
.send().await?;
|
||||||
|
|
||||||
if res.status() != 200 {
|
if res.status() != 200 {
|
||||||
|
self.show_paheko_err(res).await;
|
||||||
return Err(APIClientError::InvalidStatusCode.into());
|
return Err(APIClientError::InvalidStatusCode.into());
|
||||||
}
|
}
|
||||||
Ok(
|
Ok(
|
||||||
|
@ -476,6 +479,7 @@ impl AuthentifiedClient {
|
||||||
.send().await?;
|
.send().await?;
|
||||||
|
|
||||||
if res.status() != 200 {
|
if res.status() != 200 {
|
||||||
|
self.show_paheko_err(res).await;
|
||||||
return Err(APIClientError::InvalidStatusCode.into());
|
return Err(APIClientError::InvalidStatusCode.into());
|
||||||
}
|
}
|
||||||
Ok(UserServiceRegistration {
|
Ok(UserServiceRegistration {
|
||||||
|
@ -514,8 +518,13 @@ impl AuthentifiedClient {
|
||||||
.send().await?;
|
.send().await?;
|
||||||
|
|
||||||
if res.status() != 200 {
|
if res.status() != 200 {
|
||||||
|
self.show_paheko_err(res).await;
|
||||||
return Err(APIClientError::InvalidStatusCode.into());
|
return Err(APIClientError::InvalidStatusCode.into());
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn show_paheko_err(&self, err_response: reqwest::Response) -> () {
|
||||||
|
eprintln!("Paheko Error Details: {:?} {:?}", err_response.status(), err_response.text().await.unwrap())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue