0
votes

I can’t find any 100% answer relating to what happens when an exception occurs during a timer function app.

I have a azure timer function app that then triggers a http function app. Within the http function app an error could happen. I currently log the error and throw. However if I am throwing the error then will the application stop / will the timer function app stop executing until error has been resolved?! I would want my app to continue to run.

Can anyone provide an answer on what happens when throwing exceptions within function app / timer function app? Thanks

1
just wrap the code in a try catch blockThiago Custodio
I am doing that. I’m logging it and throwing exception. I’m working out because I’m throwing exception will it then stop the application i.e end the process? As wouldn’t want that to happen within a scheduled timer function app. Don’t wanna keep resetting the timer every time an exception has happened! Or is azure function app cleverly enough to keep to timer still after exception?!Paul
@Paul was your question answered? Please accept an answer if you feel your question was resolved, or add additional details if you think something is missing.Alex AIT

1 Answers

0
votes

The function will be triggered again when it is next due.

Source: I just set up a Azure Function with a timer trigger set to run every 15s. It contained nothing but throw Exception();. It was called multiple times, even though it threw an Exception. I recommend you try it out yourself to get a feeling for it.

PS: If you have logging set up correctly, you might not even need to log an throw - Azure Functions automatically log all unhandled exceptions.

        [FunctionName("TriggerFunction")]
        public void Run([TimerTrigger("0/15 * * * * *")]TimerInfo myTimer, ILogger log)
        {
            log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");
            throw new Exception("boom");
        }