Skip to main content

Class: DefaultFailureConverter

common.DefaultFailureConverter

Default, cross-language-compatible Failure converter.

By default, it will leave error messages and stack traces as plain text. In order to encrypt them, set encodeCommonAttributes to true in the constructor options and use a PayloadCodec that can encrypt / decrypt Payloads in your WorkerOptions.dataConverter | Worker and ClientOptions.dataConverter | Client options.

Implements

Constructors

constructor

new DefaultFailureConverter(options?): DefaultFailureConverter

Parameters

NameType
options?Partial<DefaultFailureConverterOptions>

Returns

DefaultFailureConverter

Properties

options

Readonly options: DefaultFailureConverterOptions

Methods

errorToFailure

errorToFailure(err, payloadConverter): IFailure

Converts a caught error to a Failure proto message.

Parameters

NameType
errunknown
payloadConverterPayloadConverter

Returns

IFailure

Implementation of

FailureConverter.errorToFailure


errorToFailureInner

errorToFailureInner(err, payloadConverter): IFailure

Parameters

NameType
errunknown
payloadConverterPayloadConverter

Returns

IFailure


failureToError

failureToError(failure, payloadConverter): TemporalFailure

Converts a Failure proto message to a JS Error object.

The returned error must be an instance of TemporalFailure.

Parameters

NameType
failureIFailure
payloadConverterPayloadConverter

Returns

TemporalFailure

Implementation of

FailureConverter.failureToError


failureToErrorInner

failureToErrorInner(failure, payloadConverter): TemporalFailure

Converts a Failure proto message to a JS Error object.

Does not set common properties, that is done in failureToError.

Parameters

NameType
failureIFailure
payloadConverterPayloadConverter

Returns

TemporalFailure


optionalErrorToOptionalFailure

optionalErrorToOptionalFailure(err, payloadConverter): undefined | IFailure

Converts an error to a Failure proto message if defined or returns undefined

Parameters

NameType
errunknown
payloadConverterPayloadConverter

Returns

undefined | IFailure


optionalFailureToOptionalError

optionalFailureToOptionalError(failure, payloadConverter): undefined | TemporalFailure

Converts a Failure proto message to a JS Error object if defined or returns undefined.

Parameters

NameType
failureundefined | null | IFailure
payloadConverterPayloadConverter

Returns

undefined | TemporalFailure