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
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):
[b01b6d1]15    def __init__(self, state):
16        self.state = hex(state)
17    def __str__(self):
18        return "Invalid printer state: %s" % self.state
[776a659]19
[b01b6d1]20class InvalidJobStateException(Exception):
[eee389a]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   
[b01b6d1]31    def __init__(self, state):
[eee389a]32        self.state = int(state)
[776a659]33    def __str__(self):
[eee389a]34        return "Invalid job state: %s (%s)" % \
35               (self.errstr[self.state], hex(self.state))
36
[951ab1b]37class InvalidDocument(Exception):
38    pass
[eee389a]39class MissingDataException(Exception):
40    pass
Note: See TracBrowser for help on using the repository browser.