battlecode.common
Class GameActionException
java.lang.Object
java.lang.Throwable
java.lang.Exception
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
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 |
GameActionException
public GameActionException(GameActionExceptionType type,
String message)
- Creates a GameActionException with the given type and message.
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