Class: ApplicationFailure
client.ApplicationFailure
Application failure is used to communicate application specific failures between Workflows and Activities.
Throw this exception to have full control over type and details if the exception delivered to the caller workflow or client.
Any unhandled exception which doesn't extend TemporalFailure is converted to an instance of this class before being returned to a caller.
The type property is used by {@link temporal.common.RetryOptions} to determine if
an instance of this exception is non retryable. Another way to avoid retrying an exception of
this type is by setting nonRetryable flag to true
.
The conversion of an exception that doesn't extend TemporalFailure to an ApplicationFailure is done as following:
- type is set to the exception full type name.
- message is set to the exception message
- nonRetryable is set to false
- details are set to null
- stack trace is copied from the original exception
Hierarchy
↳
ApplicationFailure
Constructors
constructor
• new ApplicationFailure(message
, type
, nonRetryable
, details?
, cause?
)
Parameters
Name | Type |
---|---|
message | undefined | string |
type | undefined | null | string |
nonRetryable | boolean |
details? | unknown [] |
cause? | Error |
Overrides
Properties
cause
• Optional
Readonly
cause: Error
Inherited from
details
• Optional
Readonly
details: unknown
[]
failure
• Optional
failure: IFailure
The original failure that constructed this error.
Only present if this error was generated from an external operation.
Inherited from
message
• message: string
Inherited from
name
• Readonly
name: string
Overrides
nonRetryable
• Readonly
nonRetryable: boolean
stack
• Optional
stack: string
Inherited from
type
• Readonly
type: undefined
| null
| string
prepareStackTrace
▪ Static
Optional
prepareStackTrace: (err
: Error
, stackTraces
: CallSite
[]) => any
Optional override for formatting stack traces
Type declaration
▸ (err
, stackTraces
): any
Optional override for formatting stack traces
see
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Parameters
Name | Type |
---|---|
err | Error |
stackTraces | CallSite [] |
Returns
any
Inherited from
TemporalFailure.prepareStackTrace
stackTraceLimit
▪ Static
stackTraceLimit: number
Inherited from
TemporalFailure.stackTraceLimit
Methods
captureStackTrace
▸ Static
captureStackTrace(targetObject
, constructorOpt?
): void
Create .stack property on a target object
Parameters
Name | Type |
---|---|
targetObject | object |
constructorOpt? | Function |
Returns
void
Inherited from
TemporalFailure.captureStackTrace
nonRetryable
▸ Static
nonRetryable(message
, type?
, ...details
): ApplicationFailure
New ApplicationFailure with nonRetryable flag set to true.
It means that this exception is not going to be retried even if it is not included into retry policy doNotRetry list.
Parameters
Name | Type | Description |
---|---|---|
message | undefined | string | optional error message |
type? | string | optional error type |
...details | unknown [] | optional details about the failure. They are serialized using the same approach as arguments and results. |
Returns
retryable
▸ Static
retryable(message
, type?
, ...details
): ApplicationFailure
New ApplicationFailure with nonRetryable flag set to false. Note that this exception still can be not retried by the service if its type is included into doNotRetry property of the correspondent retry policy.
Parameters
Name | Type | Description |
---|---|---|
message | undefined | string | optional error message |
type? | string | optional error type that is used by {@link RetryOptions.nonRetryableErrorTypes}. |
...details | unknown [] | optional details about the failure. They are serialized using the same approach as arguments and results. |