Spaces:
Running
Running
File size: 796 Bytes
ca46a75 23cd1cf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
r"""
@DATE: 2024/9/5 18:32
@File: error.py
@IDE: pycharm
@Description:
错误处理
"""
class FaceError(Exception):
def __init__(self, err, face_num):
"""
证件照人脸错误,此时人脸检测失败,可能是没有检测到人脸或者检测到多个人脸
Args:
err: 错误描述
face_num: 告诉此时识别到的人像个数
"""
super().__init__(err)
self.face_num = face_num
class APIError(Exception):
def __init__(self, err, status_code):
"""
API错误
Args:
err: 错误描述
status_code: 告诉此时的错误状态码
"""
super().__init__(err)
self.status_code = status_code
|