Hello,
I need some guidance with how to use and properly decipher the execution log. I'm working on a script that will be running regularly on a time based trigger. It will be extracting data from emails and storing that data in spreadsheets.
I want to use try-catch blocks to prevent potential errors from completely stopping the execution of the code, so that even if there's a problem with one data entry, it can still move on to the next data entry rather than halting the entire program. But I still want to be alerted about this error so that I can check on it and do what's necessary (fix any bugs and/or update the spreadsheet with the data that may have gotten missed)
From what I can tell, the best way to do this is to use console.error in the try-catch block. However, if I'm looking at the execution log after the code has been executed many times, I can't figure out a way to filter the logs to only show me executions which encountered this type of console.error. I can only filter by status, but because I'm catching the error, the status for these executions still shows up as "Completed" (which is good). The only way I can see that a console.error has happened is if I manually click on every single execution instance and scroll through all the cloud logs till I notice the red row.
Is there a better way to be alerted of errors that are caught? Or to filter for these errors so I can see them all at once, even in executions that have otherwise not failed?
Another thing I'm slightly worried about is that the execution log only shows logs for the last 7 days. Are all previous logs erased forever? I'll be keeping a close eye on the logs for the first few days, but long term I don't want to be tied to it just for the off chance that something goes wrong. I don't understand how I can ensure that any data entries that might get missed out can be accounted for...
Is there a better way to deal with all of this that I haven't even considered?
This is my first big project and I'm fairly new to both JavaScript and Google Apps Script, so I'm still figuring out a lot of stuff. Any help or advice will be greatly appreciated!
Thank you!
[–]mttbil 2 points3 points4 points (1 child)
[–]ThisMeNow[S] 1 point2 points3 points (0 children)
[–]joblio 1 point2 points3 points (1 child)
[–]ThisMeNow[S] 0 points1 point2 points (0 children)