Skip to content

Commit e031110

Browse files
committed
feat(run): handle local run failure
1 parent 8f2fef6 commit e031110

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

src/api_client.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,10 @@ pub struct FetchLocalRunReportHeadReport {
118118
#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
119119
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
120120
pub enum RunStatus {
121+
Completed,
122+
Failure,
121123
Pending,
122124
Processing,
123-
Completed,
124125
}
125126
#[derive(Debug, Deserialize, Serialize)]
126127
#[serde(rename_all = "camelCase")]

src/run/poll_results.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ pub async fn poll_results(
3939
.fetch_local_run_report(fetch_local_run_report_vars.clone())
4040
.await?
4141
{
42-
FetchLocalRunReportResponse { run, .. } if run.status != RunStatus::Completed => {
42+
FetchLocalRunReportResponse { run, .. }
43+
if run.status == RunStatus::Pending || run.status == RunStatus::Processing =>
44+
{
4345
sleep(POLLING_INTERVAL).await;
4446
}
4547
response_from_api => {
@@ -49,6 +51,10 @@ pub async fn poll_results(
4951
}
5052
}
5153

54+
if response.run.status == RunStatus::Failure {
55+
bail!("Run failed to be processed, try again in a few minutes");
56+
}
57+
5258
let report = response
5359
.run
5460
.head_reports

0 commit comments

Comments
 (0)