~divmod-dev/divmod.org/trunk

« back to all changes in this revision

Viewing changes to Imaginary/imaginary/eimaginary.py

  • Committer: Jean-Paul Calderone
  • Date: 2014-06-07 13:26:27 UTC
  • mfrom: (2741.2.2 1320678-remove-imaginary)
  • Revision ID: exarkun@twistedmatrix.com-20140607132627-jz2zhbk9jajamk43
Remove Imaginary.  Find it at <https://github.com/twisted/imaginary>.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
from twisted.cred import error
3
 
 
4
 
# Authentication errors
5
 
class BadPassword(error.UnauthorizedLogin):
6
 
    pass
7
 
 
8
 
class NoSuchUser(error.UnauthorizedLogin):
9
 
    pass
10
 
 
11
 
 
12
 
# Base Imaginary error
13
 
class ImaginaryError(Exception):
14
 
    pass
15
 
 
16
 
 
17
 
# Input handling errors
18
 
class NoSuchCommand(ImaginaryError):
19
 
    """
20
 
    There is no command like the one you tried to execute.
21
 
    """
22
 
 
23
 
class AmbiguousArgument(ImaginaryError):
24
 
    """
25
 
    One or more of the inputs specified can not be narrowed down to
26
 
    just one thing.  This can be due to the presence of multiple
27
 
    things with similar names, or due to the absence of anything named
28
 
    similarly to the given input.
29
 
 
30
 
    @ivar action: The action which was being processed when an ambiguity was
31
 
    found.
32
 
 
33
 
    @type part: C{str}
34
 
    @ivar part: The part of the command which was ambiguous.
35
 
    Typically something like 'target' or 'tool'.
36
 
 
37
 
    @type partValue: C{str}
38
 
    @ivar partValue: The string which was supplied by the user for the indicated part.
39
 
 
40
 
    @type objects: C{list} of C{IThing}
41
 
    @ivar objects: The objects which were involved in the ambiguity.
42
 
    """
43
 
 
44
 
    def __init__(self, action, part, partValue, objects):
45
 
        ImaginaryError.__init__(self, action, part, partValue, objects)
46
 
        self.action = action
47
 
        self.part = part
48
 
        self.partValue = partValue
49
 
        self.objects = objects
50
 
 
51
 
 
52
 
 
53
 
class ActionFailure(ImaginaryError):
54
 
    """
55
 
    Wrapper exception for an Event that caused an action to fail (such that the
56
 
    transaction in which it was running should be reverted).
57
 
    """
58
 
    def __init__(self, event):
59
 
        ImaginaryError.__init__(self)
60
 
        self.event = event
61
 
 
62
 
 
63
 
    def __repr__(self):
64
 
        return '<Action Failure: %r>' % (self.event,)
65
 
 
66
 
 
67
 
 
68
 
class ThingNotFound(ImaginaryError):
69
 
    """
70
 
    Resolving a Thing by identity failed.
71
 
    """
72
 
 
73
 
 
74
 
# Game logic errors
75
 
class DoesntFit(ImaginaryError):
76
 
    """
77
 
    An object tried to go into a container, but the container was full.
78
 
    """
79
 
 
80
 
 
81
 
class Closed(ImaginaryError):
82
 
    """
83
 
    An object tried to go into a container, but the container was closed.
84
 
    """
85
 
 
86
 
 
87
 
class CannotMove(ImaginaryError):
88
 
    """
89
 
    An object tried to move but it was not portable so it couldn't.
90
 
    """