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