class AuthError: REQUIRE_LOGIN = E("需要登录") TOKEN_MISS_PARAM = E("认证口令缺少参数[{0}]") APP_FIELD_CHANGE = E("应用信息发生变化") ERROR_TOKEN_TYPE = E("错误的Token类型,登录失败") PASSWORD_CHANGED = E("密码已修改,请重新登录") REQUIRE_ROOT = E("需要管理员登录") DENY_ALL_AUTH_TOKEN = E("拒绝第三方认证请求") SCOPE_NOT_SATISFIED = E("没有获取权限:[{0}]") REQUIRE_AUTH_CODE = E("需要身份认证code") NEW_AUTH_CODE_CREATED = E("授权失效")
class TalkError: CREATE_TALK = E("创建Talk错误") EXISTING_TALK = E("存在未删除Talk") CREATE_COMMIT = E("创建Commit错误") GET_COMMIT = E("获取Commit异常") GET_Talk = E("获取Talk异常") NO_MATCHED_SENTENCE = E("找不到匹配的句子") NOT_FOUND_SENTENCE = E("不存在的句子") NOT_FOUND_TAG = E("不存在的标签") CREATE_TAG = E("创建标签错误") NOT_BELONG = E("不是你的句子")
class UserError: PASSWORD_CHANGED = E("密码已改变,需要重新获取token") INVALID_PASSWORD = E("密码只能包含字母数字以及“!@#$%^&*()_+-=,.?;:”") INVALID_USERNAME_FIRST = E("用户名首字符只能是字母") INVALID_USERNAME = E("用户名只能包含字母数字和下划线") USERNAME_EXIST = E("已存在的用户名") NOT_FOUND_CODE = E("不存在的邀请码") CREATE_USER = E("存储用户错误") PASSWORD = E("错误的用户名或密码") NOT_FOUND_USER = E("不存在的用户")
class BindPhoneMessage: PHONE_FORMAT = E("手机号格式错误") SEND_WAIT = E("请在{}后重试") MODIFY_NOT_ALLOWED = E("手机号已绑定,暂不支持更改") CAPTCHA_SENT = E("验证码已发送,五分钟内有效,请使用bind -c命令验证") CAPTCHA_RESENT = E('请重新发送验证码') TIME_EXPIRED = E('验证码有效期五分钟已超出,请重新发送') CAPTCHA_WRONG = E('验证码错误,您还有{}次重试机会') SUCCESS = E('手机号绑定成功')
class BOCError: SERVICE_INACCESSIBLE = E('服务不可用') CURRENCY = E('货币名称错误,通过-s参数获取所有外币名称') SE_BN = E('短信提醒功能需要指定现汇或现钞(--se/--bn)') BID_ASK = E('短信提醒功能需要指定买入或卖出(--bid/--ask)') SMS = E('短信提醒功能需指定最大值或最小值(max/min)') STOP = E('已关闭短信提醒功能') NOT_START = E('您并没有打开短信提醒功能') START = E('已打开短信提醒功能')
class ArticleError: NOT_FOUND = E("找不到文章") CREATE = E("添加文章失败") CREATE_COMMENT = E("留言失败") NOT_FOUND_COMMENT = E("找不到留言") NOT_OWNER = E("没有权限") NOT_MATCH = E("评论和文章不匹配") DENY_OPEN_REPLY = E("文章没有开启自由评论回复功能")
class EventError: CREATE_TYPE = E("新建事件组失败") CREATE = E("添加事件失败") EMOJI = E("emoji表情错误") TYPE_NOT_FOUND = E("找不到事件组") TYPE_NOT_BELONG = E("事件组不属于此空间") NOT_FOUND = E("找不到此事件") BIND_ALBUM = E("已绑定相册")
class AuthError: REQUIRE_ROOT = E("需要管理员权限", hc=401) REQUIRE_RIGHT = E("需要{0}权限", hc=401) EXPIRED = E("登录过期", hc=401) REQUIRE_ADMIN = E("需要管理员登录", hc=401) REQUIRE_USER = E("需要登录", hc=401) TOKEN_MISS_PARAM = E("认证口令缺少参数{0}", hc=400) REQUIRE_LOGIN = E("需要登录", hc=401)
class FotoError: NOT_FOUND = E("图片不存在") CREATE = E("图片上传失败") AS_COVER = E("相册封面无法删除") ALBUM_CREATE = E("新增相册失败") ALBUM_NOT_FOUND = E("相册不存在") SPACE_CREATE = E("新增空间失败") SPACE_NOT_FOUND = E("空间不存在")
class AuthError: REQUIRE_LOGIN = E("需要登录", hc=Hc.Unauthorized) TOKEN_MISS_PARAM = E("认证口令缺少参数{0}", hc=Hc.Forbidden) REQUIRE_ROOT = E("需要root权限") MEAT_QUANTITY = E("用户的任务已达上限", hc=Hc.BadRequest) MEAT_OWNER = E("该用户不是meat的拥有者", hc=Hc.BadRequest) GEETEST_VALIDATE = E("极验验证错误")
class IDCardError: IDCARD_DETECT_ERROR = E("身份证自动验证错误") REAL_VERIFIED = E("已实名认证") CARD_NOT_COMPLETE = E("身份证正反面照片没有完善") CARD_VALID_EXPIRED = E("身份证认证过期") AUTO_VERIFY_FAILED = E("自动实名认证失败,请尝试人工认证") VERIFYING = E("您已提交认证")
class UserError: PASSWORD_CHANGED = E("密码已改变,需要重新获取token") INVALID_PASSWORD = E("密码只能包含字母数字以及“!@#$%^&*()_+-=,.?;:”") INVALID_USERNAME_FIRST = E("用户名首字符只能是字母") INVALID_USERNAME = E("用户名只能包含字母数字和下划线") USERNAME_EXIST = E("已存在的用户名") NOT_FOUND_CODE = E("不存在的邀请码") CREATE_USER = E("存储用户错误") PASSWORD = E("错误的用户名或密码") NOT_FOUND_USER = E("不存在的用户") PHONE_REGISTERED = E("手机号已被注册") ADD_MEAT_QUANTITY = E("增加天鹅肉数量错误") REDUCE_MEAT_QUANTITY = E("减少天鹅肉数量错误")
class PhoneError: SEND = E("短信发送失败")
class WeixinError: JS_CODE = E("需要鉴权代码") APP_ID = E("错误的小程序ID") DECRYPT = E("用户信息提取失败") SAFE_CHECK_FAIL = E("敏感检测失败", hc=500) CONTENT_UNSAFE = E("存在敏感内容", hc=403)
class ConfigError: CREATE_CONFIG = E("更新配置错误", hc=500) CONFIG_NOT_FOUND = E("不存在的配置", hc=404)
class ConfigError: CREATE = E("更新配置错误", hc=Hc.InternalServerError) NOT_FOUND = E("不存在的配置", hc=Hc.NotFound)
class UserError: USER_NOT_FOUND = E("不存在的用户", hc=Hc.NotFound) CREATE_USER = E("新建用户错误", hc=Hc.InternalServerError)
class QitianError: QITIAN_GET_USER_INFO_FAIL = E("齐天簿获取用户信息失败", hc=Hc.InternalServerError) QITIAN_GET_USER_PHONE_FAIL = E("齐天簿获取用户手机号失败", hc=Hc.InternalServerError) QITIAN_AUTH_FAIL = E("齐天簿身份认证失败", hc=Hc.InternalServerError) QITIAN_REQ_FAIL = E("齐天簿请求{0}失败", hc=Hc.InternalServerError)
class RoomError: Create_ROOM = E("创建房间失败") JOIN_ROOM = E("用户{0}加入房间失败") JOIN_ROOM_PASSWORD = E("加入房间({0}) 错误的密码") MEMBER_JOIN_ROOM = E("用户{0} 加入房间({1})失败") GET_ROOM_BY_PK = E("房间(id:{0})获取失败") GET_ROOM_BY_NUMBER = E("房间号:{0}获取失败") NOT_ROOM_OWNER = E("用户({0})不是房间({1})主人") NOT_ROOM_MEMBER = E("用户({0})不是房间({1})成员") LEAVE_ROOM = E("离开房间失败") CLOSE_ROOM = E("关闭房间({0})失败") ROOM_FULL = E("房间({0})人已满") ROOM_NOT_UNREADY = E("房间({0})已开始") ROOM_CHANGE_STATUS = E("房间({0})用户({1})改变状态失败") ROOM_STATUS_TRUE = E("房间({0})已经开始发言") ROOM_STATUS_FALSE = E("房间({0})还没有开始发言") MEMBER_IS_NOT_SPEAKER = E("还没有轮到用户({0})发言") CREATE_ACTION = E("房间({0})内用户({1})发言失败") ROOM_CHANGE_SPEAKER = E("房间({0})切换发言者失败")
class AuthError: REQUIRE_LOGIN = E("需要登录", hc=Hc.Unauthorized) TOKEN_MISS_PARAM = E("认证口令缺少参数{0}", hc=Hc.Forbidden)
class MilestoneError: CREATE = E("新建里程碑失败") NOT_BELONG = E("不是这个星球的里程碑") NOT_FOUND = E("里程碑不存在")
import requests from SmartDjango import E @E.register(id_processor=E.idp_cls_prefix()) class VoCError: REQUEST = E("该功能暂时无法使用") ERROR = E("内部错误,功能无法使用") class VoC: @classmethod def get(cls, url): try: with requests.post('https://v.6-79.cn/api/give-me-dl-link', json=dict(url=url, v=2)) as r: resp = r.json() except Exception: raise VoCError.REQUEST if resp['code'] == 0: return resp['body'] else: raise VoCError.ERROR
class SessionError: CAPTCHA = E("验证失败") CAPTCHA_EXPIRED = E("验证码过期,请重试") SESSION = E("会话错误,请刷新重试")
class WatchError: URL = E("url不规范") GET_URL = E("获取网页失败,请重试")
class PhraseError: SETMEMBER_CONFLICT = E("组内集合元素[{0}]重复") GET_GROUPSETMEMBER = E("获取组内集合元素[{0}]失败") GROUPSETMEMBER_NOT_FOUND = E("找不到组内集合元素[{0}]") CREATE_GROUPSETMEMBER = E("新建组内集合元素[{0}]失败") GROUP_NAME_CONFLICT = E("组别[{0}]名称重复") CREATE_GROUP = E("新增组别[{0}]失败") GET_GROUP = E("获取组别[{0}]失败") GROUP_NOT_FOUND = E("找不到组别[{0}]") CREATE_LINK = E("新增[{0}]到[{1}]的链接失败") GET_LINK = E("获取[{0}]到[{1}]的链接失败") LINK_NOT_FOUND = E("找不到[{0}]到[{1}]的链接") CREATE_TAGMAP = E("新增[{0}]对应的[{1}]属性失败") GET_TAGMAP = E("找到词语[{0}],获取其[{1}]属性失败") TAGMAP_NOT_FOUND = E("找到词语[{0}],但无[{1}]属性") TAG_NAME_CONFLICT = E("属性[{0}]名称重复") GET_TAG = E("获取属性[{0}]失败") TAG_NOT_FOUND = E("找不到标签[{0}]") CREATE_TAG = E("新增属性[{0}]失败") PHRASE_NOT_FOUND = E("找不到词语[{0}]") GET_PHRASE = E("获取词语[{0}]失败") CREATE_PHRASE = E("新增词语[{0}]失败")
class HandlerError: NOT_FOUND = E("找不到名为{0}的杰作")
class AlbumError: CREATE = E("创建相册失败") ROOT = E("主相册无法删除")
class ToolsError: REQUEST = E("该功能暂时无法使用") ERROR = E("内部错误,功能无法使用")
class VoCError: REQUEST = E("该功能暂时无法使用") ERROR = E("内部错误,功能无法使用")
class ProjectError: GET_PROJECT = E("获取项目失败") PROJECT_NOT_FOUND = E("找不到项目") NEW_PROJECT = E("新建项目错误") TICKET_INVALID = E("项目凭证错误或过期")