Skip to content

Commit

Permalink
Rename WpApiError::InvalidStatusCode to `WpApiError::InvalidHttpSta…
Browse files Browse the repository at this point in the history
…tusCode` (#245)
  • Loading branch information
oguzkocer authored Aug 8, 2024
1 parent 855484c commit 49014df
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ constructor(
WpRequestResult.WpRequestSuccess(data = executeRequest(requestBuilder))
} catch (exception: WpApiException) {
when (exception) {
is WpApiException.InvalidStatusCode -> WpRequestResult.InvalidStatusCode(
is WpApiException.InvalidHttpStatusCode -> WpRequestResult.InvalidHttpStatusCode(
statusCode = exception.statusCode,
)
is WpApiException.RequestExecutionFailed -> WpRequestResult.RequestExecutionFailed(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ sealed class WpRequestResult<T> {
val response: String,
) : WpRequestResult<T>()

class InvalidStatusCode<T>(
class InvalidHttpStatusCode<T>(
val statusCode: UShort
) : WpRequestResult<T>()

Expand Down
2 changes: 1 addition & 1 deletion wp_api/src/api_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub enum RequestExecutionError {
#[derive(Debug, PartialEq, Eq, thiserror::Error, uniffi::Error)]
pub enum WpApiError {
#[error("Status code ({}) is not valid", status_code)]
InvalidStatusCode { status_code: u16 },
InvalidHttpStatusCode { status_code: u16 },
#[error(
"Request execution failed!\nStatus Code: '{:?}'.\nResponse: '{}'",
status_code,
Expand Down
2 changes: 1 addition & 1 deletion wp_api/src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ impl WpNetworkResponse {
})
} else {
let status = http::StatusCode::from_u16(self.status_code).map_err(|_| {
WpApiError::InvalidStatusCode {
WpApiError::InvalidHttpStatusCode {
status_code: self.status_code,
}
})?;
Expand Down

0 comments on commit 49014df

Please sign in to comment.