Skip to content

Commit

Permalink
agent: catch errors from preparing discovers
Browse files Browse the repository at this point in the history
Prevent's most of the remaining possible discover errors from crashing the
agent or stopping forward progress on other discovers.
  • Loading branch information
psFried committed Jan 27, 2025
1 parent eb4884e commit ce6356e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions crates/agent/src/discovers/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ impl<C: DiscoverConnectors> DiscoverHandler<C> {
};

let image_composed = format!("{}{}", row.image_name, row.image_tag);
let disco = prepare_discover(
let prepared = prepare_discover(
row.user_id,
row.draft_id,
models::Capture::new(&row.capture_name),
Expand All @@ -140,11 +140,14 @@ impl<C: DiscoverConnectors> DiscoverHandler<C> {
data_plane,
pool,
)
.await?;
.await;

let result = self
.discover(pool, disco)
.await
let result = match prepared {
Ok(disco) => self.discover(pool, disco).await,
Err(e) => Err(e),
};

let result = result
.map_err(|err| {
vec![models::draft_error::Error {
scope: None,
Expand Down

0 comments on commit ce6356e

Please sign in to comment.