posthog_cli/utils/
mod.rs

1use anyhow::Result;
2use reqwest::blocking::Response;
3use tracing::error;
4
5pub mod auth;
6pub mod files;
7pub mod git;
8pub mod homedir;
9
10pub fn raise_for_err(response: Response) -> Result<Response> {
11    if !response.status().is_success() {
12        error!("Request failed: {:?}", response);
13        if let Ok(text) = response.text() {
14            error!("Response text: {}", text);
15        }
16        anyhow::bail!("Request failed")
17    }
18    Ok(response)
19}