ActionException

open class ActionException(message: String, cause: Throwable? = null) : RuntimeException

Base class for action execution exceptions with built-in retry classification.

Provides convenient base classes for retryable and non-retryable exceptions without requiring users to implement marker interfaces directly.

This class is open to allow users to create domain-specific exception hierarchies:

import com.embabel.agent.core.ActionException

// Extend ActionException for domain-specific exceptions
class ValidationException(message: String)
: ActionException.Permanent(message)

class ApiTimeoutException(message: String, cause: Throwable? = null)
: ActionException.Transient(message, cause)

// Or implement marker interfaces directly
import com.embabel.agent.core.NonRetryable
import com.embabel.agent.core.Retryable

class CustomValidationError(message: String)
: RuntimeException(message), NonRetryable

class CustomTimeoutError(message: String)
: RuntimeException(message), Retryable

Example usage:

import com.embabel.agent.core.ActionException;

@Action
public Result processOrder(Order order) {
if (!order.isValid()) {
// Won't be retried
throw new ActionException.Permanent("Invalid order: " + order.id);
}

try {
return externalApi.submit(order);
} catch (TimeoutException e) {
// Will be retried
throw new ActionException.Transient("API timeout", e);
}
}

See also

Inheritors

Constructors

Link copied to clipboard
constructor(message: String, cause: Throwable? = null)

Types

Link copied to clipboard
open class Permanent(message: String, cause: Throwable? = null) : ActionException, NonRetryable

Permanent failure that should not be retried.

Link copied to clipboard
open class Transient(message: String, cause: Throwable? = null) : ActionException, Retryable

Transient failure that can be retried.

Properties

Link copied to clipboard
open val cause: Throwable?
Link copied to clipboard
open val message: String?

Functions

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard