Skip to content

Commit

Permalink
Added draft implementation for error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
adelarja authored and b-yap committed Oct 25, 2023
1 parent 136d544 commit 518f8c5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions clients/vault/src/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,17 +329,17 @@ enum ServiceTask {
}

fn maybe_run<F, E>(should_run: bool, task: F) -> ServiceTask
where
F: Future<Output = Result<(), E>> + Send + 'static,
E: Into<ServiceError<Error>>,
where
F: Future<Output = Result<(), E>> + Send + 'static,
E: Into<ServiceError<Error>>,
{
ServiceTask::Optional(should_run, Box::pin(task.map_err(|x| x.into())))
}

fn run<F, E>(task: F) -> ServiceTask
where
F: Future<Output = Result<(), E>> + Send + 'static,
E: Into<ServiceError<Error>>,
where
F: Future<Output = Result<(), E>> + Send + 'static,
E: Into<ServiceError<Error>>,
{
ServiceTask::Essential(Box::pin(task.map_err(|x| x.into())))
}
Expand Down Expand Up @@ -488,7 +488,7 @@ impl VaultService {
startup_height,
account_id,
)
.handle_cancellation::<IssueCanceller>(issue_event_rx)),
.handle_cancellation::<IssueCanceller>(issue_event_rx)),
),
]
}
Expand Down Expand Up @@ -532,7 +532,7 @@ impl VaultService {
startup_height,
account_id,
)
.handle_cancellation::<ReplaceCanceller>(replace_event_rx)),
.handle_cancellation::<ReplaceCanceller>(replace_event_rx)),
),
]
}
Expand Down Expand Up @@ -752,9 +752,9 @@ impl VaultService {
self.register_vault_if_not_present(collateral_currency, wrapped_currency, amount)
},
))
.await
.into_iter()
.collect::<Result<_, Error>>()?;
.await
.into_iter()
.collect::<Result<_, Error>>()?;

// purposefully _after_ register_vault_if_not_present and _before_ other calls
self.vault_id_manager.fetch_vault_ids().await?;
Expand Down
2 changes: 1 addition & 1 deletion clients/wallet/src/stellar_wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl StellarWallet {

/// Returns a TransactionResponse after submitting transaction envelope to Stellar,
/// Else an Error.
async fn submit_transaction(
pub async fn submit_transaction(
&self,
envelope: TransactionEnvelope,
) -> Result<TransactionResponse, Error> {
Expand Down

0 comments on commit 518f8c5

Please sign in to comment.