001    /*
002     * Copyright (c) OSGi Alliance (2005, 2008). All Rights Reserved.
003     *
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     *      http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.osgi.service.upnp;
017    
018    /**
019     * There are several defined error situations describing UPnP problems while a
020     * control point invokes actions to UPnPDevices.
021     * 
022     * @since 1.1
023     * @version $Revision: 5673 $
024     */
025    public class UPnPException extends Exception {
026            static final long               serialVersionUID                = -262013318122195146L;
027    
028            /**
029             * No Action found by that name at this service.
030             */
031            public final static int INVALID_ACTION                  = 401;
032    
033            /**
034             * Not enough arguments, too many arguments with a specific name, or one of
035             * more of the arguments are of the wrong type.
036             */
037            public final static int INVALID_ARGS                    = 402;
038    
039            /**
040             * The different end-points are no longer in synchronization.
041             */
042            public final static int INVALID_SEQUENCE_NUMBER = 403;
043    
044            /**
045             * Refers to a non existing variable.
046             */
047            public final static int INVALID_VARIABLE                = 404;
048    
049            /**
050             * The invoked action failed during execution.
051             */
052            public final static int DEVICE_INTERNAL_ERROR   = 501;
053    
054            /**
055             * Key for an error information that is an int type variable and that is
056             * used to identify occured errors.
057             */
058            private final int                               errorCode;
059    
060            /**
061             * This constructor creates a UPnPException on the specified error code and
062             * error description.
063             * 
064             * @param errorCode errorCode which defined UPnP Device Architecture V1.0.
065             * @param errordesc errorDescription which explain the type of propblem.
066             */
067            public UPnPException(int errorCode, String errordesc) {
068                    super(errordesc);
069                    this.errorCode = errorCode;
070            }
071    
072            /**
073             * Returns the UPnPError Code occured by UPnPDevices during invocation.
074             * 
075             * @return The UPnPErrorCode defined by a UPnP Forum working committee or
076             *         specified by a UPnP vendor.
077             */
078            public int getUPnPError_Code() {
079                    return errorCode;
080            }
081    }