mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-10 01:17:42 +01:00
27 lines
791 B
Python
27 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')
|