mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-17 17:42:20 +03:00
Fix representation of user-defined errors
This commit is contained in:
parent
f0e3ba3aff
commit
8700924bc2
32
companion.py
32
companion.py
@ -122,36 +122,24 @@ def listify(thing):
|
|||||||
|
|
||||||
|
|
||||||
class ServerError(Exception):
|
class ServerError(Exception):
|
||||||
def __unicode__(self):
|
def __init__(self, *args):
|
||||||
return _('Error: Frontier server is down') # Raised when cannot contact the Companion API server
|
self.args = args if args else (_('Error: Frontier server is down'),) # Raised when cannot contact the Companion API server
|
||||||
def __str__(self):
|
|
||||||
return str(self)
|
|
||||||
|
|
||||||
class ServerLagging(Exception):
|
class ServerLagging(Exception):
|
||||||
def __unicode__(self):
|
def __init__(self, *args):
|
||||||
return _('Error: Frontier server is lagging') # Raised when Companion API server is returning old data, e.g. when the servers are too busy
|
self.args = args if args else (_('Error: Frontier server is lagging'),) # Raised when Companion API server is returning old data, e.g. when the servers are too busy
|
||||||
def __str__(self):
|
|
||||||
return str(self)
|
|
||||||
|
|
||||||
class SKUError(Exception):
|
class SKUError(Exception):
|
||||||
def __unicode__(self):
|
def __init__(self, *args):
|
||||||
return _('Error: Frontier server SKU problem') # Raised when the Companion API server thinks that the user has not purchased E:D. i.e. doesn't have the correct 'SKU'
|
self.args = args if args else (_('Error: Frontier server SKU problem'),) # Raised when the Companion API server thinks that the user has not purchased E:D. i.e. doesn't have the correct 'SKU'
|
||||||
def __str__(self):
|
|
||||||
return str(self)
|
|
||||||
|
|
||||||
class CredentialsError(Exception):
|
class CredentialsError(Exception):
|
||||||
def __init__(self, message=None):
|
def __init__(self, *args):
|
||||||
self.message = message and str(message) or _('Error: Invalid Credentials')
|
self.args = args if args else (_('Error: Invalid Credentials'),)
|
||||||
def __unicode__(self):
|
|
||||||
return self.message
|
|
||||||
def __str__(self):
|
|
||||||
return str(self)
|
|
||||||
|
|
||||||
class CmdrError(Exception):
|
class CmdrError(Exception):
|
||||||
def __unicode__(self):
|
def __init__(self, *args):
|
||||||
return _('Error: Wrong Cmdr') # Raised when the user has multiple accounts and the username/password setting is not for the account they're currently playing OR the user has reset their Cmdr and the Companion API server is still returning data for the old Cmdr
|
self.args = args if args else (_('Error: Wrong Cmdr'),) # Raised when the user has multiple accounts and the username/password setting is not for the account they're currently playing OR the user has reset their Cmdr and the Companion API server is still returning data for the old Cmdr
|
||||||
def __str__(self):
|
|
||||||
return str(self)
|
|
||||||
|
|
||||||
|
|
||||||
class Auth(object):
|
class Auth(object):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user