craftbeerpi4-pione/venv3/lib/python3.7/site-packages/ticket_auth/exception.py
2021-03-03 23:49:41 +01:00

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')