Hello. I have a series of cloud functions and I want to get an alert when errors occur in them. I already have the alert set and it works.
I decided to use the Cloud Logging logs: functions.logger.error(`Error ${error.message}`);
But for example when my function times out and I go to Logs Explorer I see these logs:
"Function execution started"
"Function execution took 4999 ms, finished with status: 'error' " or "Function execution took 4999 ms, finished with status: 'timeout' "
What should I do to handle those errors correctly? I tried to catch them but without good results. I would like to get a log with an ERROR severity (now their severity is DEBUG) in Cloud logging and therefore, get an alert sent to my email.
Thank you for your help.