Skip to content

Commit 318bd03

Browse files
committed
Nexus Standalone: translate already started err
1 parent c789208 commit 318bd03

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

chasm/lib/nexusoperation/handler.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ func (h *handler) StartNexusOperation(
5151
),
5252
)
5353
if err != nil {
54+
if alreadyStartedErr, ok := errors.AsType[*chasm.ExecutionAlreadyStartedError](err); ok {
55+
return nil, serviceerror.NewAlreadyExistsf(
56+
"nexus operation execution already started: request_id=%s, run_id=%s",
57+
alreadyStartedErr.CurrentRequestID,
58+
alreadyStartedErr.CurrentRunID,
59+
)
60+
}
5461
return nil, err
5562
}
5663

tests/nexus_standalone_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ func TestStartStandaloneNexusOperation(t *testing.T) {
148148
RequestId: "different-request-id",
149149
})
150150
s.Error(err)
151+
var alreadyStartedErr *serviceerror.AlreadyExists
152+
s.ErrorAs(err, &alreadyStartedErr)
153+
s.ErrorContains(err, "nexus operation execution already started")
151154

152155
// Second start with same request ID should return existing run.
153156
resp2, err := startNexusOperation(s, &workflowservice.StartNexusOperationExecutionRequest{

0 commit comments

Comments
 (0)