
org.jitsi.service.neomedia.MediaException Maven / Gradle / Ivy
/*
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jitsi.service.neomedia;
/**
* Implements an Exception thrown by the neomedia service interfaces
* and their implementations. MediaException carries an error code in
* addition to the standard Exception properties which gives more
* information about the specifics of the particular MediaException.
*
* @author Lubomir Marinov
*/
public class MediaException
extends Exception
{
/**
* Serial version UID.
*/
private static final long serialVersionUID = 0L;
/**
* The error code value which specifies that the MediaException
* carrying it does not give more information about its specifics.
*/
public static final int GENERAL_ERROR = 1;
/**
* The error code carried by this MediaException which gives more
* information about the specifics of this MediaException.
*/
private final int errorCode;
/**
* Initializes a new MediaException instance with a specific
* detailed message and {@link #GENERAL_ERROR} error code.
*
* @param message the detailed message to initialize the new instance with
*/
public MediaException(String message)
{
this(message, GENERAL_ERROR);
}
/**
* Initializes a new MediaException instance with a specific
* detailed message and a specific error code.
*
* @param message the detailed message to initialize the new instance with
* @param errorCode the error code which is to give more information about
* the specifics of the new instance
*/
public MediaException(String message, int errorCode)
{
super(message);
this.errorCode = errorCode;
}
/**
* Initializes a new MediaException instance with a specific
* detailed message, {@link #GENERAL_ERROR} error code and a specific
* Throwable cause.
*
* @param message the detailed message to initialize the new instance with
* @param cause the Throwable which is to be carried by the new
* instance and which is to be reported as the cause for throwing the new
* instance. If cause is null, the cause for throwing the
* new instance is considered to be unknown.
*/
public MediaException(String message, Throwable cause)
{
this(message, GENERAL_ERROR, cause);
}
/**
* Initializes a new MediaException instance with a specific
* detailed message, a specific error code and a specific Throwable
* cause.
*
* @param message the detailed message to initialize the new instance with
* @param errorCode the error code which is to give more information about
* the specifics of the new instance
* @param cause the Throwable which is to be carried by the new
* instance and which is to be reported as the cause for throwing the new
* instance. If cause is null, the cause for throwing the
* new instance is considered to be unknown.
*/
public MediaException(String message, int errorCode, Throwable cause)
{
super(message, cause);
this.errorCode = errorCode;
}
/**
* Gets the error code carried by this MediaException which gives
* more information about the specifics of this MediaException.
*
* @return the error code carried by this MediaException which
* gives more information about the specifics of this
* MediaException
*/
public int getErrorCode()
{
return errorCode;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy