Skip to content

Commit

Permalink
Support cloud errors that are not json
Browse files Browse the repository at this point in the history
  • Loading branch information
jackkleeman committed May 16, 2024
1 parent afdc25f commit 88f8233
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cli/src/clients/cloud/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ where
return Err(Error::Api(Box::new(ApiError {
http_status_code,
url,
body: serde_json::from_str(&body)?,
body: serde_json::from_str(&body).unwrap_or(body.into()),
})));
}

Expand Down
9 changes: 9 additions & 0 deletions cli/src/clients/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ pub struct ApiErrorBody {
message: String,
}

impl From<String> for ApiErrorBody {
fn from(message: String) -> Self {
Self {
message,
restate_code: None,
}
}
}

#[derive(Debug, Clone)]
pub struct ApiError {
pub http_status_code: reqwest::StatusCode,
Expand Down

0 comments on commit 88f8233

Please sign in to comment.