diff options
-rw-r--r-- | src/net/java/sip/communicator/service/media/MediaException.java | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/src/net/java/sip/communicator/service/media/MediaException.java b/src/net/java/sip/communicator/service/media/MediaException.java new file mode 100644 index 0000000..8d23f5b --- /dev/null +++ b/src/net/java/sip/communicator/service/media/MediaException.java @@ -0,0 +1,86 @@ +/* + * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package net.java.sip.communicator.service.media; + +/** + * Thrown when errors occur in the media package. + * + * @author Emil Ivov + */ +public class MediaException + extends Exception +{ + /** + * Set when no other error code can describe the exception that occurred. + */ + public static final int GENERAL_ERROR = 1; + + /** + * Set when command fails due to a failure in network communications or + * a transport error. + */ + public static final int NETWORK_ERROR = 2; + + /** + * Set to indicate that the service implementation needs to be started + * (initialized) before calling the method that threw the exception. + */ + public static final int SERVICE_NOT_STARTED = 3; + + /** + * Set when an operation fails for implementation specific reasons. + */ + public static final int INTERNAL_ERROR = 4; + + /** + * Set when an operation fails because of an input/output error. + */ + public static final int IO_ERROR = 4; + + /** + * The error code of the exception + */ + private int errorCode = GENERAL_ERROR; + + + /** + * Creates an exception with the specified error message and error code. + * @param message A message containing details on the error that caused the + * exception + * @param errorCode the error code of the exception (one of the error code + * fields of this class) + */ + public MediaException(String message, int errorCode) + { + super(message); + this.errorCode = errorCode; + } + + /** + * Creates an exception with the specified message, errorCode and cause. + * @param message A message containing details on the error that caused the + * exception + * @param errorCode the error code of the exception (one of the error code + * fields of this class) + * @param cause the error that caused this exception + */ + public MediaException(String message, int errorCode, Throwable cause) + { + super(message, cause); + this.errorCode = errorCode; + } + + /** + * Obtain the error code value. + * + * @return the error code for the exception. + */ + public int getErrorCode() + { + return errorCode; + } +} |