Skip to content

Commit

Permalink
Add context for eqWAlizer failures
Browse files Browse the repository at this point in the history
Summary: More context to trace eqWAlizer failures.

Reviewed By: ilya-klyuchnikov

Differential Revision: D52073971

fbshipit-source-id: 06618518fd7f09c11fc501dc7c1543d2a99c3c61
  • Loading branch information
VLanvin authored and facebook-github-bot committed Dec 12, 2023
1 parent fe92487 commit 6e4bef0
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions crates/eqwalizer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,13 @@ fn module_diagnostics(
// diagnostics, and not attempt to back-date them if they are equal to
// the memoized ones.
let timestamp = Instant::now();
match get_module_diagnostics(db, project_id, module) {
match get_module_diagnostics(db, project_id, module.clone()) {
Ok(diag) => (Arc::new(diag), timestamp),
Err(err) => (
Arc::new(EqwalizerDiagnostics::Error(format!("{}", err))),
Arc::new(EqwalizerDiagnostics::Error(format!(
"eqWAlizing module {}:\n{}",
module, err
))),
timestamp,
),
}
Expand Down Expand Up @@ -404,7 +407,12 @@ fn get_module_diagnostics(
let reply = &MsgToEqWAlizer::GetAstBytesReply { ast_bytes_len };
handle.send(reply)?;
handle.receive_newline()?;
handle.send_bytes(&ast_bytes)?;
handle.send_bytes(&ast_bytes).with_context(|| {
format!(
"sending to eqwalizer: bytes for module {} (format = {:?})",
module, format
)
})?;
}
Err(Error::ModuleNotFound(_)) => {
log::debug!(
Expand Down

0 comments on commit 6e4bef0

Please sign in to comment.