package lava.net.mmp; /** * **/ public class MMPDeliveryException extends MMPException { /** * **/ public final static int NO_ERROR_CODE_GIVEN = 0; /** * **/ public final static int CANNOT_DELIVER = 1; /** * **/ public final static int NO_DESTINATION = 2; /** * **/ public final static int UNKNOWN_PROTOCOL = 3; /** * **/ private final static String[] errorString = {// "no specific error given", // "could not deliver packet", // "no destination given", // "unknown protocol",// }; /** * **/ private int errorCode = NO_ERROR_CODE_GIVEN; /** * **/ public MMPDeliveryException() { super(); } /** * **/ public MMPDeliveryException(int errorCode) { super(errorToString(errorCode)); this.errorCode = errorCode; } /** * **/ public MMPDeliveryException(String error) { super(error); } /** * **/ public int getErrorCode() { return errorCode; } /** * **/ public static String errorToString(int errorCode) { try { return errorString[errorCode]; } catch(ArrayIndexOutOfBoundsException e) { return errorString[0]; } } }