@@ -253,19 +253,29 @@ public override async Task<WorkflowUpdateHandle<TUpdateResult>> StartUpdateWithS
253
253
}
254
254
catch ( Exception e )
255
255
{
256
- // If this is a multi-operation failure, set exception to the first non-aborted
256
+ // If this is a multi-operation failure, set exception to the first present,
257
+ // non-OK, non-aborted error
257
258
if ( e is RpcException rpcErr )
258
259
{
259
260
var status = rpcErr . GrpcStatus . Value ;
260
261
if ( status != null && status . Details . Count == 1 )
261
262
{
262
263
if ( status . Details [ 0 ] . TryUnpack ( out Api . ErrorDetails . V1 . MultiOperationExecutionFailure failure ) )
263
264
{
264
- var nonAborted = failure . Statuses . FirstOrDefault ( s => s . Details . Count == 0 ||
265
- ! s . Details [ 0 ] . Is ( Api . Failure . V1 . MultiOperationExecutionAborted . Descriptor ) ) ;
266
- var grpcStatus = new GrpcStatus ( ) { Code = nonAborted . Code , Message = nonAborted . Message } ;
267
- grpcStatus . Details . AddRange ( nonAborted . Details ) ;
268
- e = new RpcException ( grpcStatus ) ;
265
+ var nonAborted = failure . Statuses . FirstOrDefault ( s =>
266
+ // Exists
267
+ s != null &&
268
+ // Not ok
269
+ s . Code != ( int ) RpcException . StatusCode . OK &&
270
+ // Not aborted
271
+ ( s . Details . Count == 0 ||
272
+ ! s . Details [ 0 ] . Is ( Api . Failure . V1 . MultiOperationExecutionAborted . Descriptor ) ) ) ;
273
+ if ( nonAborted != null )
274
+ {
275
+ var grpcStatus = new GrpcStatus ( ) { Code = nonAborted . Code , Message = nonAborted . Message } ;
276
+ grpcStatus . Details . AddRange ( nonAborted . Details ) ;
277
+ e = new RpcException ( grpcStatus ) ;
278
+ }
269
279
}
270
280
}
271
281
}
@@ -462,7 +472,7 @@ public async override Task<WorkflowUpdateHandle<TResult>> StartWorkflowUpdateAsy
462
472
// If the requested stage is completed, wait for result, but discard the update
463
473
// exception, that will come when _they_ call get result
464
474
var handle = new WorkflowUpdateHandle < TResult > (
465
- Client , req . Request . Meta . UpdateId , input . Id , input . RunId )
475
+ Client , req . Request . Meta . UpdateId , input . Id , resp . UpdateRef . WorkflowExecution . RunId )
466
476
{ KnownOutcome = resp . Outcome } ;
467
477
if ( input . Options . WaitForStage == WorkflowUpdateStage . Completed )
468
478
{
0 commit comments