Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure timer function app exception handling

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

like image 203
Paul Avatar asked Oct 28 '25 14:10

Paul


1 Answers

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 will not even need to log a 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");
        }
like image 84
Alex AIT Avatar answered Oct 30 '25 12:10

Alex AIT



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!