Skip to content

Commit

Permalink
Don't return error if get_progress errors
Browse files Browse the repository at this point in the history
  • Loading branch information
DolceTriade committed Mar 10, 2024
1 parent cd59b55 commit ff18eb3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
11 changes: 8 additions & 3 deletions blade/db/postgres/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,17 @@ impl state::DB for Postgres {
}

fn get_progress(&mut self, invocation_id: &str) -> anyhow::Result<String> {
schema::invocations::table
match schema::invocations::table
.select(models::Invocation::as_select())
.filter(schema::invocations::id.eq(invocation_id))
.get_result(&mut self.conn)
.map(|res: models::Invocation| res.output)
.context("failed to get progress")
{
Ok(res) => Ok(res.output),
Err(e) => match e {
diesel::result::Error::NotFound => Ok("".to_string()),
_ => Err(e).context("failed to get progress"),
},
}
}

fn get_shallow_invocation(
Expand Down
11 changes: 8 additions & 3 deletions blade/db/sqlite/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,17 @@ impl state::DB for Sqlite {
}

fn get_progress(&mut self, invocation_id: &str) -> anyhow::Result<String> {
schema::Invocations::table
match schema::Invocations::table
.select(models::Invocation::as_select())
.filter(schema::Invocations::id.eq(invocation_id))
.get_result(&mut self.conn)
.map(|res: models::Invocation| res.output)
.context("failed to get progress")
{
Ok(res) => Ok(res.output),
Err(e) => match e {
diesel::result::Error::NotFound => Ok("".to_string()),
_ => Err(e).context("failed to get progress"),
},
}
}

fn get_shallow_invocation(
Expand Down

0 comments on commit ff18eb3

Please sign in to comment.