Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup leftover panics, downgrade errors to warnings where appropriate #70

Merged
merged 2 commits into from
Sep 26, 2023

Conversation

UkoeHB
Copy link
Collaborator

@UkoeHB UkoeHB commented Aug 18, 2023

Problem

  • There are still panics in the internal implementation.
  • Tracing errors are misused. An error indicates that something is broken and needs to be fixed. However, all of the current tracing errors merely indicate when something unexpected happened. Clients and servers should not treat problems caused by their counterparty as errors.

Solution

  • Remove all remaining panics.
  • Downgrade tracing errors to warnings.

@UkoeHB UkoeHB requested a review from gbaranski August 18, 2023 02:23
@@ -276,7 +276,8 @@ pub async fn connect<E: ClientExt + 'static>(
tracing::info!("connecting to {}...", config.url);
let (stream, _) = tokio_tungstenite::connect_async(http_request).await?;
if let Err(err) = client.on_connect().await {
tracing::error!("calling `connected()` failed due to {}", err);
tracing::warn!("calling `connected()` failed due to {}", err);
return Err(err);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now close the client if on_connect() returns an error, to be consistent with other client extension methods.

@UkoeHB
Copy link
Collaborator Author

UkoeHB commented Aug 18, 2023

@gbaranski can you review this one?

Copy link
Owner

@gbaranski gbaranski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a comment about the future work.
Except of that, it looks good to me :)

@@ -264,7 +264,7 @@ where
let timestamp = Duration::from_millis(timestamp as u64); // TODO: handle overflow
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should handle it somehow when the timestamp isn't there.

@UkoeHB UkoeHB merged commit 95f1155 into gbaranski:master Sep 26, 2023
3 checks passed
@UkoeHB UkoeHB deleted the acceptor_cleanup branch September 26, 2023 02:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants