Skip to main content

Interface: FailureConverter

common.FailureConverter

A FailureConverter is responsible for converting from proto Failure instances to JS Errors and back.

We recommended using the DefaultFailureConverter instead of customizing the default implementation in order to maintain cross-language Failure serialization compatibility.

Implemented by

Methods

errorToFailure

errorToFailure(err, payloadConverter): IFailure

Converts a caught error to a Failure proto message.

Parameters

NameType
errunknown
payloadConverterPayloadConverter

Returns

IFailure


failureToError

failureToError(err, payloadConverter): TemporalFailure

Converts a Failure proto message to a JS Error object.

The returned error must be an instance of TemporalFailure.

Parameters

NameType
errIFailure
payloadConverterPayloadConverter

Returns

TemporalFailure