Skip to content

Commit

Permalink
Add error context on cert validation
Browse files Browse the repository at this point in the history
Summary:
Add some additional error context when cert check fails instead of overwriting it.

Reason #1 is that our cert check could be wrong, so if it is at least we show the actual error

Reason #2 If #1 isn't true it lets us collect some data to see what errors caused by invalid certs would look like, which could be useful

Reviewed By: JakobDegen

Differential Revision: D59988439

fbshipit-source-id: a2355ea4ac39eaa1f55a431c5fbc951fa63b62f0
  • Loading branch information
Will-MingLun-Li authored and facebook-github-bot committed Jul 23, 2024
1 parent 8b7956b commit 1723f7e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/buck2_client_ctx/src/daemon/client/connect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ impl<'a> BuckdConnectOptions<'a> {
{
Ok(client) => Ok(client.with_subscribers(self.subscribers)),
Err(e) => {
handle.await.unwrap()?;
handle.await.unwrap().context("Daemon Failed to Connect")?;
self.subscribers.handle_daemon_connection_failure(&e);
Err(e.into())
}
Expand Down
4 changes: 2 additions & 2 deletions app/buck2_file_watcher/src/watchman/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,11 @@ async fn with_timeout<R>(
match tokio::time::timeout(Duration::from_secs(timeout), fut).await {
Ok(Ok(res)) => Ok(res),
Ok(Err(e)) => {
validate_certs().await?;
validate_certs().await.context("Watchman Request Failed")?;
Err(WatchmanClientError::RequestFailed(e).into())
}
Err(_) => {
validate_certs().await?;
validate_certs().await.context("Watchman Timed Out")?;
Err(WatchmanClientError::Timeout(timeout).into())
}
}
Expand Down

0 comments on commit 1723f7e

Please sign in to comment.