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
Line 
1__all__ = [
2    'InvalidJobException',
3    'InvalidPrinterStateException',
4    'InvalidJobStateException',
5    'MissingDataException'
6    ]
7
8class InvalidJobException(Exception):
9    def __init__(self, jobid):
10        self.jobid = jobid
11    def __str__(self):
12        return "Job does not exist: %d" % self.jobid
13
14class InvalidPrinterStateException(Exception):
15    errstr = {
16        3: "idle",
17        4: "processing",
18        5: "stopped"
19        }
20   
21    def __init__(self, state):
22        self.state = int(state)
23    def __str__(self):
24        return "Invalid printer state: %s (%s)" % \
25               (self.errstr[self.state], hex(self.state))
26
27class InvalidJobStateException(Exception):
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   
38    def __init__(self, state):
39        self.state = int(state)
40    def __str__(self):
41        return "Invalid job state: %s (%s)" % \
42               (self.errstr[self.state], hex(self.state))
43
44class InvalidDocument(Exception):
45    pass
46class MissingDataException(Exception):
47    pass
Note: See TracBrowser for help on using the repository browser.