@@ -728,6 +728,30 @@ await client.ExecuteUpdateWithStartWorkflowAsync(
728728 "UpdateWithStartWorkflow:TracingWorkflow" , null ) ) ;
729729 }
730730
731+ [ Fact ]
732+ public async Task TracingInterceptor_BenignExceptions_DoNotHaveErrorStatus ( )
733+ {
734+ // Confirm non-benign fail shows up as error status
735+ var ( _, activities ) = await ExecuteTracingWorkflowAsync (
736+ new ( new [ ] { new TracingWorkflowAction ( AppFail : "Non-benign fail" ) } ) ,
737+ expectFail : true ) ;
738+ var act = activities . Single ( act => act . OperationName == "CompleteWorkflow:TracingWorkflow" ) ;
739+ Assert . EndsWith (
740+ "Non-benign fail" ,
741+ act . Events . Single ( ) . Tags . Single ( t => t . Key == "exception.message" ) . Value ! . ToString ( ) ) ;
742+ Assert . Equal ( ActivityStatusCode . Error , act . Status ) ;
743+
744+ // Confirm benign fail is not error status
745+ ( _ , activities ) = await ExecuteTracingWorkflowAsync (
746+ new ( new [ ] { new TracingWorkflowAction ( BenignAppFail : "Benign fail" ) } ) ,
747+ expectFail : true ) ;
748+ act = activities . Single ( act => act . OperationName == "CompleteWorkflow:TracingWorkflow" ) ;
749+ Assert . EndsWith (
750+ "Benign fail" ,
751+ act . Events . Single ( ) . Tags . Single ( t => t . Key == "exception.message" ) . Value ! . ToString ( ) ) ;
752+ Assert . NotEqual ( ActivityStatusCode . Error , act . Status ) ;
753+ }
754+
731755 private static void AssertActivities (
732756 IReadOnlyCollection < Activity > activities , params ActivityAssertion [ ] assertions )
733757 {
@@ -907,6 +931,11 @@ public async Task RunAsync(TracingWorkflowParam param)
907931 {
908932 throw new ApplicationFailureException ( action . AppFail ) ;
909933 }
934+ if ( action . BenignAppFail != null )
935+ {
936+ throw new ApplicationFailureException (
937+ action . BenignAppFail , category : ApplicationErrorCategory . Benign ) ;
938+ }
910939 if ( action . FailOnNonReplay != null )
911940 {
912941 await RaiseOnNonReplayAsync ( action . FailOnNonReplay ) ;
@@ -1078,6 +1107,7 @@ public record TracingWorkflowParam(
10781107
10791108 public record TracingWorkflowAction (
10801109 string ? AppFail = null ,
1110+ string ? BenignAppFail = null ,
10811111 string ? FailOnNonReplay = null ,
10821112 TracingWorkflowActionChildWorkflow ? ChildWorkflow = null ,
10831113 TracingWorkflowActionActivity ? Activity = null ,
0 commit comments