1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
"""
Special Exception subclasses
"""
class XboxException(Exception):
"""Base exception for all Xbox exceptions to subclass"""
pass
class AuthenticationException(XboxException):
"""Raised when logging in fails, likely due to incorrect auth credentials"""
pass
class TwoFactorAuthRequired(XboxException):
def __init__(self, message, server_data):
"""
Raised when 2FA is required
Args:
message (str): Exception message
server_data (dict): Server data dict, extracted js object from windows live auth request
"""
super().__init__(message)
self.server_data = server_data
class InvalidRequest(XboxException):
def __init__(self, message, response):
"""
Raised when something is wrong with the request
Args:
message (str): error message returned by the server
response (requests.Response): Instance of :class:`requests.Response`
"""
self.message = message
self.response = response
class NotFoundException(XboxException):
"""Any exception raised due to a resource being missing will subclass this"""
pass
|