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