File tree Expand file tree Collapse file tree 1 file changed +13
-16
lines changed
dotNet/CoreHelpers.Extensions.Logging.DurableTask Expand file tree Collapse file tree 1 file changed +13
-16
lines changed Original file line number Diff line number Diff line change @@ -21,30 +21,27 @@ public static FunctionsApplicationBuilder UseTaskLoggingMiddleware(this Function
2121
2222 internal class InvocationTaskLoggingMiddleware : IFunctionsWorkerMiddleware
2323 {
24- public async Task Invoke ( FunctionContext context , FunctionExecutionDelegate next )
24+ public Task Invoke ( FunctionContext context , FunctionExecutionDelegate next )
2525 {
2626 // figure out if it is an orchestration function
2727 bool isOrchestration = context . FunctionDefinition . InputBindings . Values
2828 . Any ( b => b . Type . EndsWith ( "orchestrationTrigger" , StringComparison . OrdinalIgnoreCase ) ) ;
2929
3030 if ( isOrchestration )
31- {
32- await next ( context ) ;
33- }
34- else
35- {
36- var logger = context . GetLogger ( context . FunctionDefinition . Name ) ;
31+ return next ( context ) ;
32+
33+ var logger = context . GetLogger ( context . FunctionDefinition . Name ) ;
3734
38- using ( logger . BeginNewTaskScope ( context . FunctionDefinition . Name , "ActivityInvocation" , "AzureFunctionsFlexConsumption" ) )
35+ using ( logger . BeginNewTaskScope ( context . FunctionDefinition . Name , "ActivityInvocation" , "AzureFunctionsFlexConsumption" ) )
36+ {
37+ try
38+ {
39+ return next ( context ) ;
40+ }
41+ catch ( Exception ex )
3942 {
40- try
41- {
42- await next ( context ) ;
43- }
44- catch ( Exception ex )
45- {
46- logger . LogError ( ex , "An unhandled exception occurred during function invocation." ) ;
47- }
43+ logger . LogError ( ex , "An unhandled exception occurred during function invocation." ) ;
44+ throw ;
4845 }
4946 }
5047 }
You can’t perform that action at this time.
0 commit comments