mirror of
https://github.com/logos-blockchain/lez-programs.git
synced 2026-05-18 15:09:51 +00:00
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:
parent
562884d2ff
commit
b194f42204
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user