@@ -219,22 +219,20 @@ async def decode_activation(
219
219
await _decode_payloads (job .query_workflow .arguments , codec )
220
220
elif job .HasField ("resolve_activity" ):
221
221
if job .resolve_activity .result .HasField ("cancelled" ):
222
- await temporalio . exceptions .decode_failure (
223
- job .resolve_activity .result .cancelled .failure , codec
222
+ await codec .decode_failure (
223
+ job .resolve_activity .result .cancelled .failure
224
224
)
225
225
elif job .resolve_activity .result .HasField ("completed" ):
226
226
if job .resolve_activity .result .completed .HasField ("result" ):
227
227
await _decode_payload (
228
228
job .resolve_activity .result .completed .result , codec
229
229
)
230
230
elif job .resolve_activity .result .HasField ("failed" ):
231
- await temporalio .exceptions .decode_failure (
232
- job .resolve_activity .result .failed .failure , codec
233
- )
231
+ await codec .decode_failure (job .resolve_activity .result .failed .failure )
234
232
elif job .HasField ("resolve_child_workflow_execution" ):
235
233
if job .resolve_child_workflow_execution .result .HasField ("cancelled" ):
236
- await temporalio . exceptions .decode_failure (
237
- job .resolve_child_workflow_execution .result .cancelled .failure , codec
234
+ await codec .decode_failure (
235
+ job .resolve_child_workflow_execution .result .cancelled .failure
238
236
)
239
237
elif job .resolve_child_workflow_execution .result .HasField (
240
238
"completed"
@@ -245,32 +243,28 @@ async def decode_activation(
245
243
job .resolve_child_workflow_execution .result .completed .result , codec
246
244
)
247
245
elif job .resolve_child_workflow_execution .result .HasField ("failed" ):
248
- await temporalio . exceptions .decode_failure (
249
- job .resolve_child_workflow_execution .result .failed .failure , codec
246
+ await codec .decode_failure (
247
+ job .resolve_child_workflow_execution .result .failed .failure
250
248
)
251
249
elif job .HasField ("resolve_child_workflow_execution_start" ):
252
250
if job .resolve_child_workflow_execution_start .HasField ("cancelled" ):
253
- await temporalio . exceptions .decode_failure (
254
- job .resolve_child_workflow_execution_start .cancelled .failure , codec
251
+ await codec .decode_failure (
252
+ job .resolve_child_workflow_execution_start .cancelled .failure
255
253
)
256
254
elif job .HasField ("resolve_request_cancel_external_workflow" ):
257
255
if job .resolve_request_cancel_external_workflow .HasField ("failure" ):
258
- await temporalio . exceptions .decode_failure (
259
- job .resolve_request_cancel_external_workflow .failure , codec
256
+ await codec .decode_failure (
257
+ job .resolve_request_cancel_external_workflow .failure
260
258
)
261
259
elif job .HasField ("resolve_signal_external_workflow" ):
262
260
if job .resolve_signal_external_workflow .HasField ("failure" ):
263
- await temporalio .exceptions .decode_failure (
264
- job .resolve_signal_external_workflow .failure , codec
265
- )
261
+ await codec .decode_failure (job .resolve_signal_external_workflow .failure )
266
262
elif job .HasField ("signal_workflow" ):
267
263
await _decode_payloads (job .signal_workflow .input , codec )
268
264
elif job .HasField ("start_workflow" ):
269
265
await _decode_payloads (job .start_workflow .arguments , codec )
270
266
if job .start_workflow .HasField ("continued_failure" ):
271
- await temporalio .exceptions .decode_failure (
272
- job .start_workflow .continued_failure , codec
273
- )
267
+ await codec .decode_failure (job .start_workflow .continued_failure )
274
268
for val in job .start_workflow .memo .fields .values ():
275
269
# This uses API payload not bridge payload
276
270
new_payload = (await codec .decode ([val ]))[0 ]
@@ -285,7 +279,7 @@ async def encode_completion(
285
279
) -> None :
286
280
"""Recursively encode the given completion with the codec."""
287
281
if comp .HasField ("failed" ):
288
- await temporalio . exceptions . encode_failure (comp .failed .failure , codec )
282
+ await codec . encode_failure (comp .failed .failure )
289
283
elif comp .HasField ("successful" ):
290
284
for command in comp .successful .commands :
291
285
if command .HasField ("complete_workflow_execution" ):
@@ -300,14 +294,10 @@ async def encode_completion(
300
294
for val in command .continue_as_new_workflow_execution .memo .values ():
301
295
await _encode_payload (val , codec )
302
296
elif command .HasField ("fail_workflow_execution" ):
303
- await temporalio .exceptions .encode_failure (
304
- command .fail_workflow_execution .failure , codec
305
- )
297
+ await codec .encode_failure (command .fail_workflow_execution .failure )
306
298
elif command .HasField ("respond_to_query" ):
307
299
if command .respond_to_query .HasField ("failed" ):
308
- await temporalio .exceptions .encode_failure (
309
- command .respond_to_query .failed , codec
310
- )
300
+ await codec .encode_failure (command .respond_to_query .failed )
311
301
elif command .respond_to_query .HasField (
312
302
"succeeded"
313
303
) and command .respond_to_query .succeeded .HasField ("response" ):
0 commit comments