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 681d81b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cli/subcommands/src/cargo_hax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,10 @@ 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 681d81b

Please sign in to comment.