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

Parents
  • 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.

Reply
  • 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.

Children
No Data