source: server/lib/gutenbach/server/errors.py @ 5e70cc2

no-cups
Last change on this file since 5e70cc2 was 5e70cc2, checked in by Jessica B. Hamrick <jhamrick@…>, 12 years ago

Make threading in printer.py more robust

  • Property mode set to 100644
File size: 1.1 KB
RevLine 
[e58af05]1__all__ = [
2    'InvalidJobException',
[b01b6d1]3    'InvalidPrinterStateException',
4    'InvalidJobStateException',
[eee389a]5    'MissingDataException'
[e58af05]6    ]
7
[776a659]8class InvalidJobException(Exception):
9    def __init__(self, jobid):
10        self.jobid = jobid
11    def __str__(self):
[b01b6d1]12        return "Job does not exist: %d" % self.jobid
[776a659]13
14class InvalidPrinterStateException(Exception):
[5e70cc2]15    errstr = {
16        3: "idle",
17        4: "processing",
18        5: "stopped"
19        }
20   
[b01b6d1]21    def __init__(self, state):
[5e70cc2]22        self.state = int(state)
[b01b6d1]23    def __str__(self):
[5e70cc2]24        return "Invalid printer state: %s (%s)" % \
25               (self.errstr[self.state], hex(self.state))
[776a659]26
[b01b6d1]27class InvalidJobStateException(Exception):
[eee389a]28    errstr = {
29        3: "pending",
30        4: "held",
31        5: "processing",
32        6: "stopped",
33        7: "cancelled",
34        8: "aborted",
35        9: "complete"
36        }
37   
[b01b6d1]38    def __init__(self, state):
[eee389a]39        self.state = int(state)
[776a659]40    def __str__(self):
[eee389a]41        return "Invalid job state: %s (%s)" % \
42               (self.errstr[self.state], hex(self.state))
43
[951ab1b]44class InvalidDocument(Exception):
45    pass
[eee389a]46class MissingDataException(Exception):
47    pass
Note: See TracBrowser for help on using the repository browser.