walnuthq / cairovm.codes

Source code for cairovm.codes — a web app to compile Cairo programs into Sierra and CASM with step-through execution capabilities.
https://cairovm.codes
MIT License
30 stars 24 forks source link

fix: Fix compilation failure handling and error messaging #145

Closed barabanovro closed 5 months ago

barabanovro commented 5 months ago

Compilation fails when is_compilation_successful is set to false as returned by the run API endpoint. In the case of compilation failure, the message "Runtime error:" should not be printed to the console. Instead, the log messages contained within the logs array returned by the run API endpoint should be displayed.

Here is an example of a program that does not compile:

fn main() -> felt252 {
    let n = 2 + 3
    n
}

When is_compilation_successful is true, but is_execution_successful is false, the system should correctly print a runtime error. This behavior is currently working as intended and should not be changed.

An example of a program with a runtime error:

// provide '0' as argument
fn main(a: u8) -> u8 {
    1 / a
}
jaipaljadeja commented 5 months ago

i can take this one as well if you don't mind. : )

barabanovro commented 5 months ago

Hey @jaipaljadeja, I've assigned the issue to you