Table of Contents

Class ApplicationFailureException

Namespace
Temporalio.Exceptions
Assembly
Temporalio.dll

Exception representing an error in user code.

public class ApplicationFailureException : FailureException, ISerializable
Inheritance
ApplicationFailureException
Implements
Inherited Members

Remarks

For workflows, users should throw this exception to signal a workflow failure. Other non-Temporal exceptions will not fail the workflow.

In activities, all non-Temporal exceptions are translated to this exception as retryable with the Type as the unqualified exception class name.

Constructors

ApplicationFailureException(string, Exception?, string?, bool, IReadOnlyCollection<object?>?)

Initializes a new instance of the ApplicationFailureException class.

public ApplicationFailureException(string message, Exception? inner, string? errorType = null, bool nonRetryable = false, IReadOnlyCollection<object?>? details = null)

Parameters

message string

Required message for the exception.

inner Exception

Cause of the exception (can use other constructor if no cause).

errorType string

Optional string type name of the exception.

nonRetryable bool

If true, marks the exception as non-retryable.

details IReadOnlyCollection<object>

Collection of details to serialize into the exception.

ApplicationFailureException(string, string?, bool, IReadOnlyCollection<object?>?)

Initializes a new instance of the ApplicationFailureException class.

public ApplicationFailureException(string message, string? errorType = null, bool nonRetryable = false, IReadOnlyCollection<object?>? details = null)

Parameters

message string

Required message for the exception.

errorType string

Optional string type name of the exception.

nonRetryable bool

If true, marks the exception as non-retryable.

details IReadOnlyCollection<object>

Collection of details to serialize into the exception.

ApplicationFailureException(Failure, Exception?, IPayloadConverter)

Initializes a new instance of the ApplicationFailureException class.

protected ApplicationFailureException(Failure failure, Exception? inner, IPayloadConverter converter)

Parameters

failure Failure

Underlying proto failure.

inner Exception

Inner exception if any.

converter IPayloadConverter

Converter used for converting details.

Properties

Details

Gets the details of the exception. This is never null.

public IFailureDetails Details { get; protected init; }

Property Value

IFailureDetails

Remarks

This will be OutboundFailureDetails for user-created exceptions and InboundFailureDetails for server-serialized exceptions.

ErrorType

Gets the string "type" of the exception if any.

public string? ErrorType { get; protected init; }

Property Value

string

NonRetryable

Gets a value indicating whether this exception is non-retryable.

public bool NonRetryable { get; protected init; }

Property Value

bool