@@ -122,18 +122,23 @@ function (SignalWithStartInput $input): WorkflowExecution {
122122 );
123123 }
124124
125+ /**
126+ * @param non-empty-string $workflowType
127+ *
128+ * @return array{WorkflowExecution, UpdateHandle|\Throwable}
129+ */
125130 public function updateWithStart (
126131 string $ workflowType ,
127132 WorkflowOptions $ options ,
128133 UpdateOptions $ update ,
129134 array $ updateArgs = [],
130135 array $ startArgs = [],
131- ): UpdateHandle {
136+ ): array {
132137 $ arguments = EncodedValues::fromValues ($ startArgs , $ this ->converter );
133138 $ updateArguments = EncodedValues::fromValues ($ updateArgs , $ this ->converter );
134139
135140 return $ this ->interceptors ->with (
136- function (UpdateWithStartInput $ input ): UpdateHandle {
141+ function (UpdateWithStartInput $ input ): array {
137142 $ startRequest = $ this ->configureExecutionRequest (
138143 new StartWorkflowExecutionRequest (),
139144 $ input ->workflowStartInput ,
@@ -216,15 +221,19 @@ function (UpdateWithStartInput $input): UpdateHandle {
216221 $ updateResponse = $ responses [1 ]->getUpdateWorkflow ();
217222 \assert ($ updateResponse !== null );
218223
219- $ updateResult = (new \Temporal \Internal \Client \ResponseToResultMapper ($ this ->converter ))
220- ->mapUpdateWorkflowResponse (
221- $ updateResponse ,
222- updateName: $ input ->updateInput ->updateName ,
223- workflowType: $ input ->workflowStartInput ->workflowType ,
224- workflowExecution: $ execution ,
225- );
224+ try {
225+ $ updateResult = (new \Temporal \Internal \Client \ResponseToResultMapper ($ this ->converter ))
226+ ->mapUpdateWorkflowResponse (
227+ $ updateResponse ,
228+ updateName: $ input ->updateInput ->updateName ,
229+ workflowType: $ input ->workflowStartInput ->workflowType ,
230+ workflowExecution: $ execution ,
231+ );
232+ } catch (\RuntimeException $ e ) {
233+ return [$ execution , $ e ];
234+ }
226235
227- return new UpdateHandle (
236+ return [ $ execution , new UpdateHandle (
228237 client: $ this ->serviceClient ,
229238 clientOptions: $ this ->clientOptions ,
230239 converter: $ this ->converter ,
@@ -234,7 +243,7 @@ function (UpdateWithStartInput $input): UpdateHandle {
234243 resultType: $ input ->updateInput ->resultType ,
235244 updateId: $ updateResult ->getReference ()->updateId ,
236245 result: $ updateResult ->getResult (),
237- );
246+ )] ;
238247 },
239248 /** @see WorkflowClientCallsInterceptor::updateWithStart() */
240249 'updateWithStart ' ,
0 commit comments