Class RoleAssignmentException

All Implemented Interfaces:
Serializable

public class RoleAssignmentException extends TnsAIException
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 Details

    • RoleAssignmentException

      public RoleAssignmentException(String message)
      Creates a new RoleAssignmentException with the specified message.
      Parameters:
      message - the detail message
    • RoleAssignmentException

      public RoleAssignmentException(String message, Throwable cause)
      Creates a new RoleAssignmentException with the specified message and cause.
      Parameters:
      message - the detail message
      cause - the cause of this exception