COMMON = (
(100, "请求参数错误, 请升级系统"),
(101, "操作未授权,请稍后再试"),
(102, "悟空忙碌中,请稍后再试"),
(103, "系统错误,请升级系统"),
(104, "悟空忙碌中,请稍后再试"),
(105, "悟空忙碌中,请稍后再试"),
(106, "悟空忙碌中,请稍后再试"),
(107, "系统错误,请升级系统"),
(108, "系统错误,请升级系统"),
(109, "系统错误,请升级系统"),
(110, "系统错误,请升级系统"),
(400, "请求参数错误, 请升级系统"),
(401, "操作未授权,请稍后再试"),
(403, "悟空忙碌中,请稍后再试"),
(404, "系统错误,请升级系统"),
(408, "悟空忙碌中,请稍后再试"),
(409, "悟空忙碌中,请稍后再试"),
(500, "悟空忙碌中,请稍后再试"),
(501, "系统错误,请升级系统"),
(504, "系统错误,请升级系统"),
(1006, "系统错误,请升级系统"),
(1007, "系统错误,请升级系统"),
(-61, "该账户已欠费"),
(-64, "该账户已冻结"),
(-81, "已开启隐私模式,无法使用该功能"),
(-92, "已开启隐私模式,无法使用该功能"),
(-1, "机器人站起失败"),
(-2, "悟空电量低,请充电后再来点击吧"),
(-3, "悟空跌倒了,请扶起悟空再试吧"),
(-4, "悟空正在视频监控中,请稍后再试。"),
(-5, "悟空正在通话中,请通话结束后再试"),
(-7, "悟空正在升级中,等我升级完在试吧"),
(-8, "悟空正在做高难度动作,等他做完再来试试吧"),
(-9, "悟空还没绑定,请在手机上绑定他吧"),
)
# """
# 通用错误码描述
# """
SPEECH = (
(1001, "悟空忙碌中,请稍后再试"),
(1002, "网络错误,请稍后再试"),
(1003, "TTS内容为空,合成失败"),
(1004, "播放失败,音频资源已失效"),
(1005, "音频为空,请选择音效"),
(1006, "网络错误,请稍后再试"),
(1007, "网络错误,请稍后再试"),
(0, ""),
)
# """
# 语音相关错误码描述
# """
CONTENT = (
(1101, "悟空忙碌中,请稍后再试"),
(1102, "网络错误,请稍后再试"),
(1103, "TTS内容为空,合成失败"),
(1104, "播放失败,音频资源已失效"),
(0, "音频为空,请选择音效"),
)
# """
# 内容播报相关错误码描述
# """
VISION = (
(1201, "为检测到人脸,请看着悟空的眼睛,不要晃动"),
(1202, "你已经录入过人脸信息"),
(1203, "人脸信息数量已达到上限,请在APP悟空好友中删除人脸后再试"),
(1204, "人脸信息数量已达到上限,请在APP悟空好友中删除人脸后再试"),
(1205, "悟空正在录入人脸信息,请稍后再试"),
(1206, "检测到的人脸过多,请稍后再试"),
(1207, "人脸录入被打断,请稍后再试"),
(1208, "悟空电量低,无法添加新的好友"),
(1209, "网络错误,请稍后再试"),
(1210, "悟空忙碌中,请稍后再试"),
(1211, "悟空正在绘本阅读,请稍后再试"),
(1212, "悟空正处于监控中,请稍后再试"),
(1213, "悟空正在通话中,请稍后再试"),
(1214, "网络错误,请稍后再试"),
(1215, "摄像头启动失败,请重试一下"),
(1216, "摄像头好像被遮挡了,请移开遮挡物再试试"),
(1217, "识别超时"),
)
# """
# 侦测类相关错误码描述
# """
MOTION = (
(1301, "悟空忙碌中,请稍后再试"),
(1302, "悟空忙碌中,请稍后再试"),
(1304, "机器人舵机出现故障"),
(1305, "机器人舵机自我保护"),
(1306, "缺少文件,请升级系统"),
(1307, "数据异常,请升级系统"),
(1308, "数据异常,请升级系统"),
(1309, "数据异常,请升级系统"),
(1310, "数据异常,请升级系统"),
(1311, "动作正在下载中,请稍后再试"),
(1312, "执行新动作被中断"),
(1313, "动作stop中断"),
(1314, "动作stop中断"),
(1315, "动作stop中断"),
)
# """
# 运动控制相关错误码描述
# """
EXPRESS = (
(1401, "动作stop中断"),
(1402, "机器人舵机出现故障"),
(1403, "机器人舵机自我保护"),
(1404, "执行新动作被中断"),
(1405, "缺少文件,请升级系统"),
(1406, "数据异常,请升级系统"),
(1407, "数据异常,请升级系统"),
(1408, "数据异常,请升级系统"),
(1409, "数据异常,请升级系统"),
(1410, "动作正在下载中,请稍后再试"),
(1411, "缺少文件,请升级系统"),
(1412, "缺少文件,请升级系统"),
(1413, "数据异常,请升级系统"),
(1414, "数据异常,请升级系统"),
(1415, "数据异常,请升级系统"),
(1416, "悟空忙碌中,请稍后再试"),
(1417, "数据异常,请升级系统"),
)
# """
# 表情相关错误码描述
# """
[文档]def get_common_error_str(error_code: int) -> str:
"""
把通用错误码映射为错误描述
Args:
error_code (int): 错误码,在COMMON中,否则返回"未知错误"
Returns:
str : 错误描述
"""
if error_code == 0:
return ""
ret: str = "未知错误"
for t in COMMON:
if t[0] == error_code:
ret = t[1]
break
return ret
[文档]def get_speech_error_str(error_code: int) -> str:
"""
把语音相关错误码映射为错误描述
Args:
error_code (int): 错误码,在SPEECH中,否则返回None
Returns:
str : 错误描述
"""
ret = None
for t in SPEECH:
if t[0] == error_code:
ret = t[1]
break
if ret:
return ret
else:
return get_common_error_str(error_code)
[文档]def get_content_error_str(error_code: int) -> str:
"""
把内容播报相关错误码映射为错误描述
Args:
error_code (int): 错误码,在CONTENT中,否则返回None
Returns:
str : 错误描述
"""
ret = None
for t in CONTENT:
if t[0] == error_code:
ret = t[1]
break
if ret:
return ret
else:
return get_common_error_str(error_code)
[文档]def get_vision_error_str(error_code: int) -> str:
"""
把侦测类相关错误码映射为错误描述
Args:
error_code (int): 错误码,在VISION中,否则返回None
Returns:
str : 错误描述
"""
ret = None
for t in VISION:
if t[0] == error_code:
ret = t[1]
break
if ret:
return ret
else:
return get_common_error_str(error_code)
[文档]def get_motion_error_str(error_code: int) -> str:
"""
把运动控制相关错误码映射为错误描述
Args:
error_code (int): 错误码,在MOTION中,否则返回None
Returns:
str : 错误描述
"""
ret = None
for t in MOTION:
if t[0] == error_code:
ret = t[1]
break
if ret:
return ret
else:
return get_common_error_str(error_code)
[文档]def get_express_error_str(error_code: int) -> str:
"""
把表情相关错误码映射为错误描述
Args:
error_code (int): 错误码,在EXPRESS中,否则返回None
Returns:
str : 错误描述
"""
ret = None
for t in EXPRESS:
if t[0] == error_code:
ret = t[1]
break
if ret:
return ret
else:
return get_common_error_str(error_code)