Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Handle unexpected solc outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
zemse committed Dec 18, 2023
1 parent 917e51b commit 54109e0
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/utils/solidity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,23 @@ fn compile_artifact(input: &Input) -> Result<Output, Error> {
}

let output = solc.wait_with_output()?;
let output: Output = serde_json::from_str(std::str::from_utf8(&output.stdout).unwrap())?;
Ok(output)
if let Ok(output) = serde_json::from_str(std::str::from_utf8(&output.stdout).unwrap()) {
Ok(output)
} else {
if !output.stdout.is_empty() {
println!(
"solc stdout: {:?}",
std::str::from_utf8(&output.stdout).unwrap()
);
}
if !output.stderr.is_empty() {
println!(
"solc stderr {:?}",
std::str::from_utf8(&output.stderr).unwrap()
);
}
Err(Error::InternalError("unexpected solc output"))
}
}

#[derive(Clone, Debug, Serialize, Deserialize)]
Expand Down

0 comments on commit 54109e0

Please sign in to comment.