Skip to content

Commit c4b4260

Browse files
committed
Fix version not found error type and test flakes
1 parent 1f75c8e commit c4b4260

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

service/worker/workerdeployment/client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,8 @@ func (d *ClientImpl) SetCurrentVersion(
541541
res.ConflictToken = details[0].GetData()
542542
}
543543
return &res, nil
544+
} else if failure := outcome.GetFailure(); failure.GetApplicationFailureInfo().GetType() == errVersionNotFound {
545+
return nil, serviceerror.NewNotFound(errVersionNotFound)
544546
} else if failure.GetApplicationFailureInfo().GetType() == errFailedPrecondition {
545547
return nil, serviceerror.NewFailedPrecondition(failure.Message)
546548
} else if failure != nil {
@@ -630,6 +632,8 @@ func (d *ClientImpl) SetRampingVersion(
630632
}
631633

632634
return &res, nil
635+
} else if failure := outcome.GetFailure(); failure.GetApplicationFailureInfo().GetType() == errVersionNotFound {
636+
return nil, serviceerror.NewNotFound(errVersionNotFound)
633637
} else if failure.GetApplicationFailureInfo().GetType() == errFailedPrecondition {
634638
return nil, serviceerror.NewFailedPrecondition(failure.Message)
635639
} else if failure != nil {

service/worker/workerdeployment/workflow.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ func (d *WorkflowRunner) validateStateBeforeAcceptingRampingUpdate(args *deploym
416416

417417
if _, ok := d.State.GetVersions()[args.Version]; !ok && args.Version != "" && args.Version != worker_versioning.UnversionedVersionId {
418418
d.logger.Info("version not found in deployment")
419-
return temporal.NewApplicationError(fmt.Sprintf("requested ramping version %s not found in deployment", args.Version), errFailedPrecondition)
419+
return temporal.NewApplicationError(fmt.Sprintf("requested ramping version %s not found in deployment", args.Version), errVersionNotFound)
420420
}
421421

422422
return nil
@@ -653,7 +653,7 @@ func (d *WorkflowRunner) validateStateBeforeAcceptingSetCurrent(args *deployment
653653
}
654654
if _, ok := d.State.Versions[args.Version]; !ok && args.Version != worker_versioning.UnversionedVersionId {
655655
d.logger.Info("version not found in deployment")
656-
return temporal.NewApplicationError(fmt.Sprintf("version %s not found in deployment", args.Version), errFailedPrecondition)
656+
return temporal.NewApplicationError(fmt.Sprintf("version %s not found in deployment", args.Version), errVersionNotFound)
657657
}
658658
return nil
659659
}

0 commit comments

Comments
 (0)