Skip to content

Commit

Permalink
remove unneeded async and result on parse_error
Browse files Browse the repository at this point in the history
  • Loading branch information
tsfotis committed Sep 19, 2024
1 parent 465e17c commit 652bd64
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions core/src/services/cloudflare_kv/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ impl kv::Adapter for Adapter {
let status = resp.status();
match status {
StatusCode::OK => Ok(Some(resp.into_body())),
_ => Err(parse_error(resp).await?),
_ => Err(parse_error(resp)),
}
}

Expand All @@ -222,7 +222,7 @@ impl kv::Adapter for Adapter {
let status = resp.status();
match status {
StatusCode::OK => Ok(()),
_ => Err(parse_error(resp).await?),
_ => Err(parse_error(resp)),
}
}

Expand All @@ -236,7 +236,7 @@ impl kv::Adapter for Adapter {
let status = resp.status();
match status {
StatusCode::OK => Ok(()),
_ => Err(parse_error(resp).await?),
_ => Err(parse_error(resp)),
}
}

Expand All @@ -263,7 +263,7 @@ impl kv::Adapter for Adapter {
})?;
Ok(response.result.into_iter().map(|r| r.name).collect())
}
_ => Err(parse_error(resp).await?),
_ => Err(parse_error(resp)),
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/services/cloudflare_kv/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use crate::raw::*;
use crate::*;

/// Parse error response into Error.
pub(crate) async fn parse_error(resp: Response<Buffer>) -> Result<Error> {
pub(crate) fn parse_error(resp: Response<Buffer>) -> Error {
let (parts, mut body) = resp.into_parts();
let bs = body.copy_to_bytes(body.remaining());

Expand Down Expand Up @@ -59,7 +59,7 @@ pub(crate) async fn parse_error(resp: Response<Buffer>) -> Result<Error> {
err = err.set_temporary();
}

Ok(err)
err
}

pub(crate) fn parse_cfkv_error_code(errors: Vec<CfKvError>) -> Option<(ErrorKind, bool)> {
Expand Down

0 comments on commit 652bd64

Please sign in to comment.