battlecode.common
Class GameActionException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by battlecode.common.GameActionException
All Implemented Interfaces:
Serializable

public class GameActionException
extends Exception

An exception caused by a robot's interaction with the game world. For instance, trying to move a robot into an occupied square will cause a GameActionException to be thrown.

Each GameActionException has a type that roughly identifies what caused the exception.

In addition to GameActionException, some robot functions can throw the unchecked exceptions IllegalStateException and IllegalArgumentException. An IllegalStateException is thrown if this robot can never successfully call the function (for example, a solder trying to regenerate). An IllegalArgumentException is thrown if this type of robot can never successfully call the function with the given arguments (for example, an archon trying to spawn another archon). A GameActionException is thrown in all other circumstances.

See Also:
Serialized Form

Constructor Summary
GameActionException(GameActionExceptionType type, String message)
          Creates a GameActionException with the given type and message.
 
Method Summary
 GameActionExceptionType getType()
          Gives the type of gameworld interaction that caused this GameActionException, which was specified when this instance was constructed.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GameActionException

public GameActionException(GameActionExceptionType type,
                           String message)
Creates a GameActionException with the given type and message.

Method Detail

getType

public GameActionExceptionType getType()
Gives the type of gameworld interaction that caused this GameActionException, which was specified when this instance was constructed.

Returns:
this GameActionException's type