2022-12-09 10:45:51 +01:00
|
|
|
package robot.exceptions;
|
2022-12-09 01:38:11 +01:00
|
|
|
|
|
|
|
public class RobotException extends Exception{
|
2022-12-21 16:44:49 +01:00
|
|
|
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;
|
2022-12-09 01:38:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2022-12-21 16:44:49 +01:00
|
|
|
|