question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exception not propagating from Activity to Orchestrator

See original GitHub issue

My desire is to put the orchestrator into a ‘Failed’ state if an Activity doesn’t successfully complete (throws an exception).

My understanding is that an uncaught exception in an Activity would be raised in the Orchestrator, however I’m not seeing this behaviour.

Infact I’ve ran the below code to try and force an exception but I still can’t get the orchestrator to fail.

Please can you advise if my expectations or code are wrong here?

Also, customStatus is not being set so I’m pretty confident that the catch block isn’t even entering.

Azure Functions v2 - DF 1.7.1

Orchestrator

[FunctionName("Orchestrator")]
public static async Task<List<string>> RunOrchestratorAsync([OrchestrationTrigger] DurableOrchestrationContextBase context)
{
            .....
            try
            {
                things = await context.CallActivityAsync<Queue<Thing>>("get_things", request);
            }
            catch (FunctionFailedException ex)
            {
                context.SetCustomStatus($"caught ex {ex.Message}");
                throw new Exception("caught ex", ex);
            }
            catch (Exception ex)
            {
                context.SetCustomStatus($"caught ex {ex.Message}");
                throw new Exception("caught ex", ex);
            }
            ......
}

Activity


[FunctionName("get_things")]
        public static async Task<Queue<Thing>> Run([ActivityTrigger] Request request, ILogger log)
        {
                throw new Exception("Forced Failure");
        }

Orchestrator History

PartitionKey | RowKey | Timestamp | EventId | EventId@type | EventType | EventType@type | ExecutionId | ExecutionId@type | IsPlayed | IsPlayed@type | _Timestamp | _Timestamp@type | Input | Input@type | Name | Name@type | OrchestrationInstance | OrchestrationInstance@type | Version | Version@type | Result | Result@type | TaskScheduledId | TaskScheduledId@type | OrchestrationStatus | OrchestrationStatus@type |   |   – | – | – | – | – | – | – | – | – | – | – | – | – | – | – | – | – | – | – | – | – | – | – | – | – | – | – | – | – bb1ee432-1f9d-42a1-9401-7481c7c54c7b | 0000000000000000 | 2019-02-14T17:27:31.020Z | -1 | Edm.Int32 | OrchestratorStarted | Edm.String | 28a8693a972244e0b512f9fc961b54f4 | Edm.String | false | Edm.Boolean | 2019-02-14T17:27:30.210Z | Edm.DateTime |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   bb1ee432-1f9d-42a1-9401-7481c7c54c7b | 0000000000000001 | 2019-02-14T17:27:31.020Z | -1 | Edm.Int32 | ExecutionStarted | Edm.String | 28a8693a972244e0b512f9fc961b54f4 | Edm.String | true | Edm.Boolean | 2019-02-14T17:27:29.496Z | Edm.DateTime | <REDACTED> | Edm.String | Orchestrator | Edm.String | {“InstanceId”:“bb1ee432-1f9d-42a1-9401-7481c7c54c7b”,“ExecutionId”:“28a8693a972244e0b512f9fc961b54f4”} | Edm.String |   | Edm.String |   |   |   |   |   |   |   |   bb1ee432-1f9d-42a1-9401-7481c7c54c7b | 0000000000000002 | 2019-02-14T17:27:31.021Z | 0 | Edm.Int32 | TaskScheduled | Edm.String | 28a8693a972244e0b512f9fc961b54f4 | Edm.String | false | Edm.Boolean | 2019-02-14T17:27:30.848Z | Edm.DateTime |   |   | get_things | Edm.String |   |   |   | Edm.String |   |   |   |   |   |   |   |   bb1ee432-1f9d-42a1-9401-7481c7c54c7b | 0000000000000003 | 2019-02-14T17:27:31.021Z | -1 | Edm.Int32 | OrchestratorCompleted | Edm.String | 28a8693a972244e0b512f9fc961b54f4 | Edm.String | false | Edm.Boolean | 2019-02-14T17:27:30.848Z | Edm.DateTime |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   bb1ee432-1f9d-42a1-9401-7481c7c54c7b | 0000000000000004 | 2019-02-14T17:27:32.088Z | -1 | Edm.Int32 | OrchestratorStarted | Edm.String | 28a8693a972244e0b512f9fc961b54f4 | Edm.String | false | Edm.Boolean | 2019-02-14T17:27:31.981Z | Edm.DateTime |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   bb1ee432-1f9d-42a1-9401-7481c7c54c7b | 0000000000000005 | 2019-02-14T17:27:32.088Z | -1 | Edm.Int32 | TaskCompleted | Edm.String | 28a8693a972244e0b512f9fc961b54f4 | Edm.String | true | Edm.Boolean | 2019-02-14T17:27:31.849Z | Edm.DateTime |   |   |   |   |   |   |   |   | [] | Edm.String | 0 | Edm.Int32 |   |   |   |   bb1ee432-1f9d-42a1-9401-7481c7c54c7b | 0000000000000006 | 2019-02-14T17:27:32.088Z | 1 | Edm.Int32 | ExecutionCompleted | Edm.String | 28a8693a972244e0b512f9fc961b54f4 | Edm.String | false | Edm.Boolean | 2019-02-14T17:27:32.060Z | Edm.DateTime |   |   |   |   |   |   |   |   | [] | Edm.String |   |   | Completed | Edm.String |   |   bb1ee432-1f9d-42a1-9401-7481c7c54c7b | 0000000000000007 | 2019-02-14T17:27:32.088Z | -1 | Edm.Int32 | OrchestratorCompleted | Edm.String | 28a8693a972244e0b512f9fc961b54f4 | Edm.String | false | Edm.Boolean | 2019-02-14T17:27:32.078Z | Edm.DateTime |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   bb1ee432-1f9d-42a1-9401-7481c7c54c7b | sentinel | 2019-02-14T17:27:32.088Z |   |   |   |   | 28a8693a972244e0b512f9fc961b54f4 | Edm.String |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |     |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |     |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
olitomlinsoncommented, Feb 14, 2019

Found the problem, my code running in azure was not as I thought it was. Apologies for wasting your time!

0reactions
olitomlinsoncommented, Feb 14, 2019

Sorry ‘get_things’ was my attempt at obfuscating!

Oops. You are correct its not the exact same code. I’ll update the code in the original issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it possible to catch specific Exceptions in Azure Durable ...
If an exception is raised in the activity function, it is propagated to the orchestrator, which can then catch it and handle it...
Read more >
Error Handling with Durable Functions
In an unhandled exception is thrown by an activity function, it will propagate up to the orchestrator function. This is brilliant as it ......
Read more >
Handling errors in Durable Functions (Azure Functions)
Any exception that is thrown in an activity function is marshaled back to the orchestrator function and thrown as a FunctionFailedException ...
Read more >
Topics tagged exception_handling
Need help on how to get a activity name which failed during execution · Activities · web , exception_handling. 11 ; Prevent exception...
Read more >
System exception.The activity 'Try Catch' with ID 21 threw ...
hello, i'm using the REFramework in my project and i get the error below when i run it in the orchestrator, what this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found