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