我认为标题说明了问题所在,但我将显示代码。
raise AccountBannedException(self.account)
使Celery工作日志为raised unexpected: BrowserAccountException('General BrowserAccountException.',)
。
每个的代码是:
class AccountBannedException(BrowserAccountException):
def __init__(self, account):
self.account = account
self.message = "Account " + self.account.email + " is banned."
self.account.retired = True
super(AccountBannedException, self).__init__(message=self.message)
class BrowserAccountException(BrowserException):
def __init__(self, email=None, password=None, message=None):
self.email = email
self.password = password
if message is None:
message = "General BrowserAccountException."
self.message = message
super(BrowserAccountException, self).__init__(message=self.message)
打印出异常将显示其实际含义。也将其提升到Celery之外。芹菜似乎不会默认对其进行报告。
编辑:我发现当我不写self.account.retired = True
时,它说了应该说的:Account "<MSAccount(email ='someone@example.com')>" is banned.