zalo / CascadeStudio

A Full Live-Scripted CAD Kernel in the Browser
https://zalo.github.io/CascadeStudio/
MIT License
1.01k stars 126 forks source link

CascadeStudio error reporting #38

Closed udif closed 3 years ago

udif commented 3 years ago

Another bug/missing feature is a generic mechanism that shows errors in terms of script line numbers instead of pointing to the line number inside CascadeStudio where eval() is called with the script. I've tried fixing that myself in a my private copy using a try {} block around the eval() call:

    eval('try { ' + payload.code + ' } catch(err) { console.log("xxx" , err.stack); }');

But couldn't get any useful result (I know enough Javascript to write models for CascadeStudio, but has zero knowledge about front end programming). Apparently you can only get so far by copying StackOverflow code snippets.

zalo commented 3 years ago

I just added function name and line-number reporting for Chrome (unfortunately I can't quite figure out the codepath for how Firefox's errors are getting printed, so errors there will continue to be "dumb" errors; presumably likewise for Safari).