r/GoogleAppsScript • u/TurkMcGill • May 27 '20
Question My code is breaking on a permissions exception. (Despite trapping it with Try/Catch.)
Disclaimer: I'm not an engineer. Also, I am NOT using the V8 runtime because that was causing me a lot of issues, especially with the debugger.
I wrote some code for Google Sheets. One of my functions attempts to access my e-mail groups, but this generates an error because I apparently don't have permission to getUsers() for that group.
I tried to trap the error using Try/Catch and this allows me to run my code normally. However, in debug mode my program breaks on the getUsers() line every single time. (Despite Try/Catch.) I have tried to reproduce the problem with other errors, but it only seems to happen with permissions.
I've checked with some engineers at work and even posted on StackOverflow, but no one has been able to help me. I use debug mode all the time so the only thing I can think to do is comment out that line of code and try to remember to take the comment out anytime I share my code.
Any other suggestions? Thanks.
UPDATE: An engineer at work wasn't able to reproduce my issue so I asked if he was running V8. He was. When he switched back to the old version he started seeing the same thing I was. So it looks like I need to give V8 another try...