-
Notifications
You must be signed in to change notification settings - Fork 5
fail to send logging #1255
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
fail to send logging #1255
Conversation
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
|
|
||
| if extraction_status != ExtractionStatusEnum::Incomplete { | ||
| ws_send( | ||
| if let Err(err) = ws_send( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.inspect_err is cleaner here imo.
| // We have been polling this attachment for too long, so we should stop | ||
| // polling it. | ||
| ws_send( | ||
| if let Err(err) = ws_send( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.inspect_err
| if let Err(e) = sender.send(message) { | ||
| tracing::error!(error=%e, "failed to send message to channel"); | ||
| } | ||
| pub fn ws_send( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you do tracing::instrument here you could have it automatically log errors for you so you don't need to map error each time
| .await; | ||
| if let Err(err) = result { | ||
| ws_send( | ||
| if let Err(err) = result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inspect err
| Ok(access) => match access { | ||
| AccessLevel::View | AccessLevel::Comment => { | ||
| ws_send( | ||
| if let Err(send_err) = ws_send( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inspect err
| Ok(access) => match access { | ||
| AccessLevel::View | AccessLevel::Comment => { | ||
| ws_send( | ||
| if let Err(send_err) = ws_send( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inspect err
| { | ||
| Err(e) => { | ||
| ws_send(&message_sender_clone, FromWebSocketMessage::Error(e)); | ||
| if let Err(send_err) = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inspect err
| Ok(id) => Arc::new(id), | ||
| Err(_) => { | ||
| ws_send( | ||
| if let Err(send_err) = ws_send( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inspect err
| )), | ||
| ), | ||
| }; | ||
| if let Err(send_err) = send_result { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inspect err
| ensure_user_attachment_access(&ctx, user_context.clone(), attachments).await | ||
| { | ||
| ws_send(&message_sender_clone, FromWebSocketMessage::Error(err)); | ||
| if let Err(send_err) = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inspect err
Address PR feedback: - Add #[tracing::instrument(skip(sender), err)] to ws_send - Replace if let Err patterns with .ok() since errors now auto-logged - Remove redundant manual error logging at ws_send call sites Co-Authored-By: Claude Opus 4.5 <[email protected]>
8fab42e to
21e34ce
Compare
No description provided.