~ubuntu-branches/ubuntu/trusty/python-axiom/trusty

« back to all changes in this revision

Viewing changes to axiom/errors.py

  • Committer: Bazaar Package Importer
  • Author(s): Stefano Zacchiroli
  • Date: 2007-04-01 19:09:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070401190903-ar7yssg8lwv3si1h
Tags: upstream-0.5.0
ImportĀ upstreamĀ versionĀ 0.5.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
from twisted.cred.error import UnauthorizedLogin
 
3
 
 
4
class BadCredentials(UnauthorizedLogin):
 
5
    pass
 
6
 
 
7
class NoSuchUser(UnauthorizedLogin):
 
8
    pass
 
9
 
 
10
class DuplicateUser(Exception):
 
11
    pass
 
12
 
 
13
class CannotOpenStore(RuntimeError):
 
14
    """
 
15
    There is a problem such that the store cannot be opened.
 
16
    """
 
17
 
 
18
class NoUpgradePathAvailable(CannotOpenStore):
 
19
    """
 
20
    No upgrade path is available, so the store cannot be opened.
 
21
    """
 
22
 
 
23
class NoCrossStoreReferences(AttributeError):
 
24
    """
 
25
    References are not allowed between items within different Stores.
 
26
    """
 
27
 
 
28
class SQLError(RuntimeError):
 
29
    """
 
30
    Axiom internally generated some bad SQL.
 
31
    """
 
32
    def __init__(self, sql, args, underlying):
 
33
        RuntimeError.__init__(self, sql, args, underlying)
 
34
        self.sql, self.args, self.underlying = self.args
 
35
 
 
36
    def __str__(self):
 
37
        return "<SQLError: %r(%r) caused %s: %s>" % (
 
38
            self.sql, self.args,
 
39
            self.underlying.__class__, self.underlying)
 
40
 
 
41
 
 
42
 
 
43
class UnknownItemType(Exception):
 
44
    """
 
45
    Can't load an item: it's of a type that I don't see anywhere in Python.
 
46
    """
 
47
 
 
48
 
 
49
 
 
50
class SQLWarning(Warning):
 
51
    """
 
52
    Axiom internally generated some CREATE TABLE SQL that ... probably wasn't bad
 
53
    """
 
54
 
 
55
 
 
56
class TableCreationConcurrencyError(RuntimeError):
 
57
    """
 
58
    Woah, this is really bad.  If you can get this please tell us how.
 
59
    """
 
60
 
 
61
class DuplicateUniqueItem(KeyError):
 
62
    """
 
63
    Found 2 or more of an item which is supposed to be unique.
 
64
    """
 
65
 
 
66
class ItemNotFound(KeyError):
 
67
    """
 
68
    Did not find even 1 of an item which was supposed to exist.
 
69
    """