@@ -908,7 +908,7 @@ def _error_to_failure(
908
908
failure .child_workflow_execution_failure_info .retry_state = (
909
909
temporalio .api .enums .v1 .RetryState .ValueType (error .retry_state or 0 )
910
910
)
911
- # TODO(dan ): test coverage for this
911
+ # TODO(nexus-prerelease ): test coverage for this
912
912
elif isinstance (error , temporalio .exceptions .NexusOperationError ):
913
913
failure .nexus_operation_execution_failure_info .SetInParent ()
914
914
failure .nexus_operation_execution_failure_info .operation_token = (
@@ -921,44 +921,6 @@ def from_failure(
921
921
payload_converter : PayloadConverter ,
922
922
) -> BaseException :
923
923
"""See base class."""
924
-
925
- # message Failure {
926
- # string message = 1;
927
- # // The source this Failure originated in, e.g. TypeScriptSDK / JavaSDK
928
- # // In some SDKs this is used to rehydrate the stack trace into an exception object.
929
- # string source = 2;
930
- # string stack_trace = 3;
931
- # // Alternative way to supply `message` and `stack_trace` and possibly other attributes, used for encryption of
932
- # // errors originating in user code which might contain sensitive information.
933
- # // The `encoded_attributes` Payload could represent any serializable object, e.g. JSON object or a `Failure` proto
934
- # // message.
935
- # //
936
- # // SDK authors:
937
- # // - The SDK should provide a default `encodeFailureAttributes` and `decodeFailureAttributes` implementation that:
938
- # // - Uses a JSON object to represent `{ message, stack_trace }`.
939
- # // - Overwrites the original message with "Encoded failure" to indicate that more information could be extracted.
940
- # // - Overwrites the original stack_trace with an empty string.
941
- # // - The resulting JSON object is converted to Payload using the default PayloadConverter and should be processed
942
- # // by the user-provided PayloadCodec
943
- # //
944
- # // - If there's demand, we could allow overriding the default SDK implementation to encode other opaque Failure attributes.
945
- # // (-- api-linter: core::0203::optional=disabled --)
946
- # temporal.api.common.v1.Payload encoded_attributes = 20;
947
- # Failure cause = 4;
948
- # oneof failure_info {
949
- # ApplicationFailureInfo application_failure_info = 5;
950
- # TimeoutFailureInfo timeout_failure_info = 6;
951
- # CanceledFailureInfo canceled_failure_info = 7;
952
- # TerminatedFailureInfo terminated_failure_info = 8;
953
- # ServerFailureInfo server_failure_info = 9;
954
- # ResetWorkflowFailureInfo reset_workflow_failure_info = 10;
955
- # ActivityFailureInfo activity_failure_info = 11;
956
- # ChildWorkflowExecutionFailureInfo child_workflow_execution_failure_info = 12;
957
- # NexusOperationFailureInfo nexus_operation_execution_failure_info = 13;
958
- # NexusHandlerFailureInfo nexus_handler_failure_info = 14;
959
- # }
960
- # }
961
-
962
924
# If encoded attributes are present and have the fields we expect,
963
925
# extract them
964
926
if failure .HasField ("encoded_attributes" ):
@@ -1032,15 +994,6 @@ def from_failure(
1032
994
else None ,
1033
995
)
1034
996
elif failure .HasField ("child_workflow_execution_failure_info" ):
1035
- # message ChildWorkflowExecutionFailureInfo {
1036
- # string namespace = 1;
1037
- # temporal.api.common.v1.WorkflowExecution workflow_execution = 2;
1038
- # temporal.api.common.v1.WorkflowType workflow_type = 3;
1039
- # int64 initiated_event_id = 4;
1040
- # int64 started_event_id = 5;
1041
- # temporal.api.enums.v1.RetryState retry_state = 6;
1042
- # }
1043
-
1044
997
child_info = failure .child_workflow_execution_failure_info
1045
998
err = temporalio .exceptions .ChildWorkflowError (
1046
999
failure .message or "Child workflow error" ,
@@ -1057,15 +1010,6 @@ def from_failure(
1057
1010
else None ,
1058
1011
)
1059
1012
elif failure .HasField ("nexus_handler_failure_info" ):
1060
- # message NexusHandlerFailureInfo {
1061
- # // The Nexus error type as defined in the spec:
1062
- # // https://github.com/nexus-rpc/api/blob/main/SPEC.md#predefined-handler-errors.
1063
- # string type = 1;
1064
- # // Retry behavior, defaults to the retry behavior of the error type as defined in the spec.
1065
- # temporal.api.enums.v1.NexusHandlerErrorRetryBehavior retry_behavior = 2;
1066
- # }
1067
- # TODO(dan): check that handler-side phenomena are correctly turning into this vs nexus_operation_execution_failure_info
1068
- # TODO(dan): What exception should be raised for this vs nexus_operation_execution_failure_info?
1069
1013
nexus_handler_failure_info = failure .nexus_handler_failure_info
1070
1014
err = temporalio .exceptions .NexusHandlerError (
1071
1015
failure .message or "Nexus handler error" ,
@@ -1075,26 +1019,7 @@ def from_failure(
1075
1019
temporalio .api .enums .v1 .NexusHandlerErrorRetryBehavior .NEXUS_HANDLER_ERROR_RETRY_BEHAVIOR_NON_RETRYABLE : False ,
1076
1020
}.get (nexus_handler_failure_info .retry_behavior ),
1077
1021
)
1078
- print (f"got err { err .__class__ } with retryable" , err ._retryable )
1079
1022
elif failure .HasField ("nexus_operation_execution_failure_info" ):
1080
- # message NexusOperationFailureInfo {
1081
- # // The NexusOperationScheduled event ID.
1082
- # int64 scheduled_event_id = 1;
1083
- # // Endpoint name.
1084
- # string endpoint = 2;
1085
- # // Service name.
1086
- # string service = 3;
1087
- # // Operation name.
1088
- # string operation = 4;
1089
- # // Operation ID - may be empty if the operation completed synchronously.
1090
- # //
1091
- # // Deprecated: Renamed to operation_token.
1092
- # string operation_id = 5;
1093
- # // Operation token - may be empty if the operation completed synchronously.
1094
- # string operation_token = 6;
1095
- # }
1096
- # TODO(dan)
1097
- # This is covered by cancellation tests
1098
1023
nexus_op_failure_info = failure .nexus_operation_execution_failure_info
1099
1024
err = temporalio .exceptions .NexusOperationError (
1100
1025
failure .message or "Nexus operation error" ,
0 commit comments