configurationengine/source/cone/public/exceptions.py
changeset 0 2e8eeb919028
child 3 e7e0ae78773e
equal deleted inserted replaced
-1:000000000000 0:2e8eeb919028
       
     1 #
       
     2 # Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 # All rights reserved.
       
     4 # This component and the accompanying materials are made available
       
     5 # under the terms of "Eclipse Public License v1.0"
       
     6 # which accompanies this distribution, and is available
       
     7 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 #
       
     9 # Initial Contributors:
       
    10 # Nokia Corporation - initial contribution.
       
    11 #
       
    12 # Contributors:
       
    13 #
       
    14 # Description:
       
    15 #
       
    16 ## 
       
    17 # @author Teemu Rytkonen
       
    18 
       
    19 class ConeException(Exception):
       
    20     pass
       
    21 
       
    22 class NotSupportedException(ConeException):
       
    23     def __init__(self, message=""):
       
    24         self.message = "Not supported! %s" % message
       
    25         ConeException.__init__(self, self.message)
       
    26 
       
    27 class StorageException(ConeException):
       
    28     pass
       
    29     
       
    30 class NotResource(StorageException):
       
    31     pass
       
    32     
       
    33 class NotFound(ConeException):
       
    34     pass
       
    35     
       
    36 class NotBound(ConeException):
       
    37     pass
       
    38     
       
    39 class NoParent(ConeException):
       
    40     pass
       
    41     
       
    42 class AlreadyExists(ConeException):
       
    43     pass
       
    44     
       
    45 class ConePersistenceError(ConeException):
       
    46     pass
       
    47     
       
    48 class ParseError(ConeException):
       
    49     """
       
    50     Exception raised when invalid data is attempted to be parsed.
       
    51     
       
    52     The attributes ``desc`` and ``lineno`` contain a description of
       
    53     the error and the line on which the error occurred, if available.
       
    54     The exception message itself may be composed of these two to make it more
       
    55     readable, but it may also just be the same as the description.
       
    56     
       
    57     @message: Exception message.
       
    58     @param lineno: The line number where the error occurred. Can be None to
       
    59         signify that the line number is not available.
       
    60     @param desc: Error description. If None, the exception message will be
       
    61         used here also.
       
    62     """
       
    63     def __init__(self, message, lineno=None, desc=None):
       
    64         ConeException.__init__(self, message)
       
    65         self.lineno = lineno
       
    66         self.desc = desc or message
       
    67 
       
    68 class XmlParseError(ParseError):
       
    69     pass
       
    70 
       
    71 class IncorrectClassError(ConeException):
       
    72     pass
       
    73     
       
    74 class InvalidRef(ConeException):
       
    75     pass
       
    76     
       
    77 class InvalidObject(ConeException):
       
    78     """ This error is raised inside the ObjectContainer class when in any container 
       
    79     operation an invalid object is encountered. 
       
    80     """
       
    81     pass