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
Name | Type |
---|---|
options? | Partial <DefaultFailureConverterOptions > |
Returns
Properties
options
• Readonly
options: DefaultFailureConverterOptions
Methods
errorToFailure
▸ errorToFailure(err
, payloadConverter
): IFailure
Converts a caught error to a Failure proto message.
Parameters
Name | Type |
---|---|
err | unknown |
payloadConverter | PayloadConverter |
Returns
Implementation of
FailureConverter.errorToFailure
errorToFailureInner
▸ errorToFailureInner(err
, payloadConverter
): IFailure
Parameters
Name | Type |
---|---|
err | unknown |
payloadConverter | PayloadConverter |
Returns
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
Name | Type |
---|---|
failure | IFailure |
payloadConverter | PayloadConverter |
Returns
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
Name | Type |
---|---|
failure | IFailure |
payloadConverter | PayloadConverter |
Returns
optionalErrorToOptionalFailure
▸ optionalErrorToOptionalFailure(err
, payloadConverter
): undefined
| IFailure
Converts an error to a Failure proto message if defined or returns undefined
Parameters
Name | Type |
---|---|
err | unknown |
payloadConverter | PayloadConverter |
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
Name | Type |
---|---|
failure | undefined | null | IFailure |
payloadConverter | PayloadConverter |
Returns
undefined
| TemporalFailure