source: server/lib/gutenbach/server/errors.py @ 951ab1b

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

Add support for verifying documents in job.py

  • Property mode set to 100644
File size: 1003 bytes
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    def __init__(self, state):
16        self.state = hex(state)
17    def __str__(self):
18        return "Invalid printer state: %s" % self.state
19
20class InvalidJobStateException(Exception):
21    errstr = {
22        3: "pending",
23        4: "held",
24        5: "processing",
25        6: "stopped",
26        7: "cancelled",
27        8: "aborted",
28        9: "complete"
29        }
30   
31    def __init__(self, state):
32        self.state = int(state)
33    def __str__(self):
34        return "Invalid job state: %s (%s)" % \
35               (self.errstr[self.state], hex(self.state))
36
37class InvalidDocument(Exception):
38    pass
39class MissingDataException(Exception):
40    pass
Note: See TracBrowser for help on using the repository browser.