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 06e22f3 commit c548cad
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 c548cad

Please sign in to comment.