configurationengine/source/cone/public/exceptions.py
author m2lahtel
Tue, 10 Aug 2010 14:29:28 +0300
changeset 3 e7e0ae78773e
parent 0 2e8eeb919028
permissions -rw-r--r--
ConE 1.2.11 release
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):
3
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    20
    """
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    21
    Base class for ConE exceptions.
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    22
    
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    23
    The attributes ``problem_desc`` and ``problem_lineno`` contain a description of
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    24
    the error and the line on which the error occurred, if available.
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    25
    The exception message itself may be composed of these two to make it more
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    26
    readable, but it may also just be the same as the description.
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    27
    
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    28
    @message: Exception message.
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    29
    @param problem_lineno: The line number for api.Problem conversion. Can be None to
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    30
        signify that the line number is not available.
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    31
    @param problem_desc: Error description for api.Problem conversion. If None,
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    32
        the exception message will be used here also.
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    33
    @param problem_type: Problem type for api.Problem conversion. If None, the
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    34
        class-level default will be used.
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    35
    """
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    36
    
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    37
    #: Problem type for conversion to api.Problem.
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    38
    #: A default can be set on the exception class level, but it may
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    39
    #: also be set for individual exception instances.
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    40
    problem_type = None
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    41
    
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    42
    def __init__(self, message='', problem_lineno=None, problem_msg=None, problem_type=None):
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    43
        Exception.__init__(self, message)
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    44
        self.problem_lineno = problem_lineno
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    45
        self.problem_msg = problem_msg or message
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    46
        if problem_type is not None:
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    47
            self.problem_type = problem_type
0
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    48
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    49
class NotSupportedException(ConeException):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    50
    def __init__(self, message=""):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    51
        self.message = "Not supported! %s" % message
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    52
        ConeException.__init__(self, self.message)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    53
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    54
class StorageException(ConeException):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    55
    pass
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    56
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    57
class NotResource(StorageException):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    58
    pass
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    59
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    60
class NotFound(ConeException):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    61
    pass
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    62
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    63
class NotBound(ConeException):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    64
    pass
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    65
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    66
class NoParent(ConeException):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    67
    pass
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    68
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    69
class AlreadyExists(ConeException):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    70
    pass
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    71
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    72
class ConePersistenceError(ConeException):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    73
    pass
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    74
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    75
class ParseError(ConeException):
3
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    76
    pass
0
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    77
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    78
class XmlParseError(ParseError):
3
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    79
    problem_type = 'xml'
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    80
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    81
class XmlSchemaValidationError(ParseError):
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    82
    problem_type = 'schema'
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    83
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    84
class ConfmlParseError(ParseError):
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    85
    problem_type = 'model.confml'
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    86
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    87
class ImplmlParseError(ParseError):
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    88
    problem_type = 'model.implml'
0
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    89
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    90
class IncorrectClassError(ConeException):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    91
    pass
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    92
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    93
class InvalidRef(ConeException):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    94
    pass
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    95
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    96
class InvalidObject(ConeException):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    97
    """ This error is raised inside the ObjectContainer class when in any container 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    98
    operation an invalid object is encountered. 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    99
    """
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   100
    pass
3
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
   101
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
   102
class NameIdMappingError(ConeException):
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
   103
    """
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
   104
    Exception raised when resolving a name-ID mapped value fails.
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
   105
    """
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
   106
    pass
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
   107