fix(idl-gen): handle serde_json serialization error explicitly instead of panicking

Agent-Logs-Url: https://github.com/logos-blockchain/lez-programs/sessions/c96af723-7390-4496-9838-2cdd2083ab3d

Co-authored-by: 3esmit <224810+3esmit@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-05-06 20:39:46 +00:00 committed by GitHub
parent 562884d2ff
commit b194f42204
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,11 +10,13 @@ fn main() {
};
match spel_framework_core::idl_gen::generate_idl_from_file(&path) {
Ok(idl) => println!(
"{}",
serde_json::to_string_pretty(&idl)
.expect("serializing generated IDL to JSON should not fail")
),
Ok(idl) => match serde_json::to_string_pretty(&idl) {
Ok(json) => println!("{json}"),
Err(e) => {
eprintln!("Error serializing IDL to JSON: {e}");
process::exit(1);
}
},
Err(e) => {
eprintln!("Error: {e}");
process::exit(1);