javascriptdebugginggoogle-apps-scripttry-catchgoogle-apps-script-editor

Why does Try / Catch in Google Apps Script stop code execution in debug mode?


I am using Google Apps Script in a Google Sheet. I added some code recently that was causing an error due to me trying to access locked data. I tried some basic error trapping using Try / Catch and this works fine when I run my code, but in debug mode the program halts execution on the line in question. Am I using Try / Catch wrong, or is there something else I'm missing?

Here's my code:

  for (var i=0;i<userGroups.length;i++) {
    try {
      var temp = userGroups[i].getUsers();
    } catch(error) {
      console.log(error); 
    }
    ...

NOTE: I am NOT using the V8 runtime as it was causing me a lot of issues.


Solution

  • If you are not using V8, it is an intended behavior that the debugger stops execution at any error - handled or not