You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm slowly thinking about what ways Catspeak could be extended slightly to include an artificial stacktrace of potential files or other place/s where the end user might end up doing something that's wrong or invalid.
I already have a system in my own project, where I can generate a stacktrace from my own files, and push/pop them. But if you any Catspeak code that also makes functions, the stacktrace part itself gets trickier.
Assuming we have this as our Catspeak program
add=fun(a,b){returna+b;}
And our GML code
varfilename="gamecode.meow";varstr=load_string_from_file(filename);varast=Catspeak.parseString(str);varmainProgram=Catspeak.compile(ast);program();varadd=mainProgram.getGlobals().add;add(undefined,2);// Errors as undefined cannot be added together with 2
Please describe in detail how you expect this new feature to behave.
I have some ideas I could experiment with, but I might just do it as my own modifications to Catspeak itself for my own project. Since I can't think of a real universal solution for this. The closest idea I have so far involves modifying how __catspeak_function__ works slightly (to implement a catch callback handler), providing .compile() with some optional arguments for a stacktrace_name (so one could provide "game_code.meow" or "https://gamewebsite.com/game_assets/game_code.meow" or whatever as a name to refer it to for debugging purposes), and appending .getStacktraceName() to each and every Catspeak function.
All of this is something I'll experiment with anyway, but the idea I have in code:
Catspeak.setCatchCallback(function(ex,program){ex.longMessage+=$"\nIn {program.getStacktraceName()}";// I'd return or throw ex, but my idea would be that Catspeak handles throwing ex still, so no need to do anything else here.});// Compilingvarfilename="gamecode.meow";varstr=load_string_from_file(filename);varast=Catspeak.parseString(str);varmainProgram=Catspeak.compile(ast,filename);program();varadd=mainProgram.getGlobals().add;add(undefined,2);// Errors as undefined cannot be added together with 2, but also __catspeak_function__ runs // our catch callback function, allowing us to append our stacktrace on top of it. So we end up with "In gamecode.meow" at the end.
The text was updated successfully, but these errors were encountered:
What is your feature request?
I'm slowly thinking about what ways Catspeak could be extended slightly to include an artificial stacktrace of potential files or other place/s where the end user might end up doing something that's wrong or invalid.
I already have a system in my own project, where I can generate a stacktrace from my own files, and push/pop them. But if you any Catspeak code that also makes functions, the stacktrace part itself gets trickier.
Assuming we have this as our Catspeak program
And our GML code
Please describe in detail how you expect this new feature to behave.
I have some ideas I could experiment with, but I might just do it as my own modifications to Catspeak itself for my own project. Since I can't think of a real universal solution for this. The closest idea I have so far involves modifying how
__catspeak_function__
works slightly (to implement a catch callback handler), providing.compile()
with some optional arguments for astacktrace_name
(so one could provide"game_code.meow"
or"https://gamewebsite.com/game_assets/game_code.meow"
or whatever as a name to refer it to for debugging purposes), and appending.getStacktraceName()
to each and every Catspeak function.All of this is something I'll experiment with anyway, but the idea I have in code:
The text was updated successfully, but these errors were encountered: