2023-07-24 03:52:25 +00:00
|
|
|
from django.utils.translation import gettext_lazy as _
|
2022-06-28 09:39:13 +00:00
|
|
|
|
|
|
|
from common.exceptions import JMSException
|
|
|
|
|
|
|
|
|
|
|
|
class SSOAuthClosed(JMSException):
|
|
|
|
default_code = 'sso_auth_closed'
|
|
|
|
default_detail = _('SSO auth closed')
|
|
|
|
|
|
|
|
|
|
|
|
class WeComCodeInvalid(JMSException):
|
|
|
|
default_code = 'wecom_code_invalid'
|
|
|
|
default_detail = 'Code invalid, can not get user info'
|
|
|
|
|
|
|
|
|
|
|
|
class WeComBindAlready(JMSException):
|
2022-07-15 09:17:56 +00:00
|
|
|
default_code = 'wecom_not_bound'
|
|
|
|
default_detail = _('WeCom is already bound')
|
2022-06-28 09:39:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
class WeComNotBound(JMSException):
|
|
|
|
default_code = 'wecom_not_bound'
|
2022-07-15 09:17:56 +00:00
|
|
|
default_detail = _('WeCom is not bound')
|
2022-06-28 09:39:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
class DingTalkNotBound(JMSException):
|
|
|
|
default_code = 'dingtalk_not_bound'
|
2022-07-15 09:17:56 +00:00
|
|
|
default_detail = _('DingTalk is not bound')
|
2022-06-28 09:39:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
class FeiShuNotBound(JMSException):
|
|
|
|
default_code = 'feishu_not_bound'
|
2022-07-15 09:17:56 +00:00
|
|
|
default_detail = _('FeiShu is not bound')
|
2022-06-28 09:39:13 +00:00
|
|
|
|
|
|
|
|
2023-12-08 07:11:49 +00:00
|
|
|
class SlackNotBound(JMSException):
|
|
|
|
default_code = 'slack_not_bound'
|
|
|
|
default_detail = _('Slack is not bound')
|
|
|
|
|
|
|
|
|
2022-06-28 09:39:13 +00:00
|
|
|
class PasswordInvalid(JMSException):
|
|
|
|
default_code = 'passwd_invalid'
|
|
|
|
default_detail = _('Your password is invalid')
|
2023-10-07 05:07:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
class IntervalTooShort(JMSException):
|
|
|
|
default_code = 'interval_too_short'
|
|
|
|
default_detail = _('Please wait for %s seconds before retry')
|
|
|
|
|
|
|
|
def __init__(self, interval, *args, **kwargs):
|
|
|
|
super().__init__(detail=self.default_detail % interval, *args, **kwargs)
|