File size: 619 Bytes
eba303d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from api_exception.exception import APIException

from common.enum.ai_service_error import AiServiceError


class Conflict(APIException):
    status_code = 409
    default_detail = "Conflict"
    default_code = "conflict"


class AiServiceException(APIException):
    status_code = 400

    def __init__(self, ai_error_code: AiServiceError, detail=None, status_code=None):
        self.error_code = ai_error_code.value
        self.detail = detail if detail is not None else ai_error_code.value
        if status_code is not None:
            self.status_code = status_code
        super().__init__(detail=self.detail)