Pr_robot_factory/robot/exceptions/RobotException.java

23 lines
634 B
Java

package robot.exceptions;
public class RobotException extends Exception{
robotExceptions currentType;
public RobotException(robotExceptions type, String name){
super(getMessage(type, name));
this.currentType = type;
}
private static String getMessage(robotExceptions types, String name){
String message = "";
switch (types){
case ILLEGALSTATE: message = name + " is turned off."; break;
case MAGICVALUE: message = name + " has an unknown error. Code 42."; break;
case EMPTYARRAY: message = name + " got an empty array."; break;
}
return message;
}
}