Package com.tnsai.roles.registry
Class RoleAssignmentException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.tnsai.exceptions.TnsAIException
com.tnsai.roles.registry.RoleAssignmentException
- All Implemented Interfaces:
Serializable
Exception thrown when a role assignment fails due to exclusivity constraints.
This exception is thrown when attempting to assign a role with
@RoleSpec(shared=false) to an agent when that role
is already assigned to another agent.
Usage Example
try {
RoleRegistry.getInstance().assignRole(agent, new LeaderRole());
} catch (RoleAssignmentException e) {
// Handle case where role is already taken
log.warn("Could not assign leader role: {}", e.getMessage());
}
- Author:
- TnsAI Team
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionRoleAssignmentException(String message) Creates a new RoleAssignmentException with the specified message.RoleAssignmentException(String message, Throwable cause) Creates a new RoleAssignmentException with the specified message and cause. -
Method Summary
Methods inherited from class com.tnsai.exceptions.TnsAIException
getContext, getErrorCode, getMaxRetryAttempts, getMessage, getSuggestedRetryDelayMs, getThrownAt, isRetryable, wrapMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
RoleAssignmentException
Creates a new RoleAssignmentException with the specified message.- Parameters:
message- the detail message
-
RoleAssignmentException
Creates a new RoleAssignmentException with the specified message and cause.- Parameters:
message- the detail messagecause- the cause of this exception
-