我认为如果我们能够像在 python/js/ruby 中那样抛出并捕获错误类型,那就太好了,因为我们现在有了类。所以如果我只想捕获特定的错误类型,我可以这样做。
并且能够拥有一个可以让类继承的内置错误类型将会很棒。然后让 exception_msg 成为更容易解析信息(包括带有行的回溯)的类,而不是 {"Name Unresolved: bbb"(1, 2, "bbb", bbb /*###*/)}。
这样我们就可以做类似的事情
Names default to here(1);
try(
a = bbb;
,
show(exception_msg["message"]) // show the relevant message
show(exception_msg["caller"]) // what function the exception happened in
show(exception_msg["traceback"][2]["message"]);
show(exception_msg["traceback"][2]["line"]);
);
类似于此https://community.jmp.com/t5/JMP-Wish-List/Improved-JSL-Stack-Trace-in-Log-on-Error/idi-p/78104