Skip to content

Commit

Permalink
fix(frontend): catches panic from prettyplease (implemented!)
Browse files Browse the repository at this point in the history
  • Loading branch information
W95Psp committed Jul 10, 2024
1 parent ab7fbe4 commit 3b5a15d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cli/subcommands/src/cargo_hax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,11 @@ fn run_engine(
}
FromEngine::PrettyPrintRust(code) => {
let code = match syn::parse_file(&code) {
Ok(file) => Ok(prettyplease::unparse(&file)),
Ok(file) => match std::panic::catch_unwind(|| prettyplease::unparse(&file))
{
Ok(pp) => Ok(pp),
Err(err) => Err(format!("prettyplease panicked with: {:#?}", err)),
},
Err(err) => Err(format!("{}", err)),
};
send!(&ToEngine::PrettyPrintedRust(code));
Expand Down

0 comments on commit 3b5a15d

Please sign in to comment.