Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Add some context to wasm error message (it is quite long)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcnski committed Apr 5, 2023
1 parent 6b66e91 commit 6fa0046
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion node/core/pvf/src/execute/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,13 @@ impl Response {
Self::InvalidCandidate(format!("{}: {}", ctx, msg))
}
}
fn format_internal(ctx: &'static str, msg: &str) -> Self {
if msg.is_empty() {
Self::InternalError(ctx.to_string())
} else {
Self::InternalError(format!("{}: {}", ctx, msg))
}
}
}

/// The entrypoint that the spawned execute worker should start with. The `socket_path` specifies
Expand Down Expand Up @@ -362,7 +369,7 @@ fn validate_using_artifact(
Err(err) =>
return if err.contains("failed to open file: No such file or directory") {
// Raise an internal error if the file is missing.
Response::InternalError(err)
Response::format_internal("execute: missing file", &err)
} else {
Response::format_invalid("execute", &err)
},
Expand Down

0 comments on commit 6fa0046

Please sign in to comment.