demergent-labs / azle

A WebAssembly runtime for TypeScript and JavaScript on ICP
MIT License
204 stars 36 forks source link

More actionable error messages #1456

Open ulan opened 11 months ago

ulan commented 11 months ago

Hi folks! Thanks for the great work here. I tried version0.18.6 in my project: https://github.com/ulan/ic-config-canister/blob/main/src/index.ts

It worked well and was mostly smooth. One thing I noticed is that error messages could be improved.

Here is an example:

Replica Error: reject code CanisterError, reject message IC0503: Canister bkyz2-fmaaa-aaaaa-qaaaq-cai trapped explicitly: Panicked at 'called `Result::unwrap()` on an `Err` value: Uncaught TypeError: not a function
    at <anonymous> (main.js:99653)
    at executeMethod (main.js:99407)
    at <anonymous> (main.js:99451)

1) The Rust part "Panicked at 'called Result::unwrap() on an Err value" is just noise and could be dropped completely. 2) The line numbers are off. Maybe there is a way to put the user file at the beginning of main.js or find a way to use two files.

lastmjs commented 3 months ago

Greatly improving error messages is part of 1.0 which we're focusing on for the next few months