mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-12-23 22:14:56 +01:00
28 lines
791 B
Python
28 lines
791 B
Python
|
|
||
|
class TicketError(Exception):
|
||
|
"""Base class for errors generated by the module"""
|
||
|
def __init__(self, ticket, msg=''):
|
||
|
self.ticket = ticket
|
||
|
self.msg = msg
|
||
|
|
||
|
def __str__(self):
|
||
|
return 'Ticket error: {0} ({1})'.format(self.msg, self.ticket)
|
||
|
|
||
|
|
||
|
class TicketParseError(TicketError):
|
||
|
"""Error parsing the ticket string"""
|
||
|
def __init__(self, ticket, msg=''):
|
||
|
super().__init__(ticket, msg)
|
||
|
|
||
|
|
||
|
class TicketDigestError(TicketError):
|
||
|
"""Exception raised when a tickets digest is incorrect"""
|
||
|
def __init__(self, ticket):
|
||
|
super().__init__(ticket, 'Invalid digest')
|
||
|
|
||
|
|
||
|
class TicketExpired(TicketError):
|
||
|
"""Exception raised when a ticket has expired"""
|
||
|
def __init__(self, ticket):
|
||
|
super().__init__(ticket, 'Ticket expired')
|