zom-lang / zom

Zom is a Ahead Of Time compiled system programming language.
Other
4 stars 2 forks source link

Error format lines panic #2

Closed thi8v closed 1 year ago

thi8v commented 1 year ago

If in the future, you have an error on a line greater than 99,999, you'll have an error by the formater.

By hardcoding the line number in the error message like that (in GeneralError, fmt implementation at line 140, at commit a190c95f4e1f7f4f12f61057b77bf4d142c63457) and we make the REPL have a GeneralError (e.g., with float parsing error) :

// ...
num_str_fix_len(100_000, 5)
// ...

You have the following error :

thread 'main' panicked at 'attempt to subtract with overflow', src/error.rs:57:20
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thi8v commented 1 year ago

when solving this issue, create a "global" function that displays the error instead of copy/pasting each time a new error structure is created.