Exception not caught

This an embarrassing question but - how does exception handling work in Monkey C? In all logic with the code 

  try {
    var n = 0; // compiler complains about forced 0/0 otherwise
    System.println("before");
    var m = 0/n;
    System.println("what?");
  } catch (e) {
    System.println("handling");
  }
System.println("done");

I should see the chain before -> handling -> done. Now I bomb out with an Error: Invalid Value on the div by zero. Isn't catch(e) the catch-all?

According to the docs, Exception.printStackTrace() returns an Object (not String). Is it still String (or how should I collect the stack trace to a String)? I'm thinking of some sort of centralized error reporting to a REST endpoint

  • Umm. Ignore this post. It probably is related to my thread that basically says "why doesn't everything I put in my source and compile end up in the binaries". Works as expected today, have to take a closer look at the binary timestamps etc.

  • how does exception handling work in Monkey C? In all logic with the code 

    Not all errors are exceptions. Some errors are handled by the system by returning an error code and crashing your app.

    Exception support was added to MonkeyC later in its development, and there are some cases where the old error system is still used; dividing by zero is one of those cases.

  • According to the docs, Exception.printStackTrace() returns an Object (not String). Is it still String (or how should I collect the stack trace to a String)? I'm thinking of some sort of centralized error reporting to a REST endpoint

    The function is printStackTrace()... It isn't returning the stack trace as a String, it is supposed to print the stack trace to the log file.