Add error_for_status_ref for functions
This commit is contained in:
parent
982fcb36ec
commit
cf8d664349
1 changed files with 2 additions and 0 deletions
|
@ -78,6 +78,7 @@ impl Client {
|
|||
) -> Result<Vec<Post>> {
|
||||
self.request_limiter().await;
|
||||
let res = self.list_posts_raw(limit, tags, page).await?;
|
||||
res.error_for_status_ref()?;
|
||||
Ok(res.json::<RawPosts>().await?.into())
|
||||
}
|
||||
|
||||
|
@ -101,6 +102,7 @@ impl Client {
|
|||
pub async fn get_post(&mut self, post_id: Id) -> Result<Post> {
|
||||
self.request_limiter().await;
|
||||
let res = self.get_post_raw(post_id).await?;
|
||||
res.error_for_status_ref()?;
|
||||
Ok(res.json::<RawPost>().await?.into())
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue