Package io.temporal.common.converter
Interface FailureConverter
-
- All Known Implementing Classes:
DefaultFailureConverter
public interface FailureConverter
AFailureConverter
is responsible for converting from protoFailure
instances to JavaException
, and back.Most users should _never_ need to implement a failure converter. We strongly recommended relying on the
DefaultFailureConverter
, in order to maintain cross-language Failure serialization compatibility.To _encrypt_ the content of failures, see
CodecDataConverter
instead.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description io.temporal.api.failure.v1.Failure
exceptionToFailure(java.lang.Throwable throwable, DataConverter dataConverter)
Serialize an existing Java Exception into a Failure object.TemporalFailure
failureToException(io.temporal.api.failure.v1.Failure failure, DataConverter dataConverter)
Instantiate an appropriate Java Exception from a serialized Failure object.default FailureConverter
withContext(SerializationContext context)
-
-
-
Method Detail
-
failureToException
@Nonnull TemporalFailure failureToException(@Nonnull io.temporal.api.failure.v1.Failure failure, @Nonnull DataConverter dataConverter)
Instantiate an appropriate Java Exception from a serialized Failure object.- Parameters:
failure
- Failure protobuf object to deserialize into an exceptiondataConverter
- to be used to convertFailure#encodedAttributes
andFailure#failure_info#details
(if present).- Returns:
- deserialized exception
- Throws:
java.lang.NullPointerException
- if either failure or dataConverter is null
-
exceptionToFailure
@Nonnull io.temporal.api.failure.v1.Failure exceptionToFailure(@Nonnull java.lang.Throwable throwable, @Nonnull DataConverter dataConverter)
Serialize an existing Java Exception into a Failure object.- Parameters:
throwable
- A Java Exception object to serialize into a Failure protobuf objectdataConverter
- to be used to convertFailure#encodedAttributes
andFailure#failure_info#details
(if present).- Returns:
- serialized exception
- Throws:
java.lang.NullPointerException
- if either e or dataConverter is null
-
withContext
@Nonnull default FailureConverter withContext(@Nonnull SerializationContext context)
-
-