File size: 592 Bytes
a8b45b8 1fac9b0 a8b45b8 a305767 28af5bc a8b45b8 28af5bc a8b45b8 28af5bc | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | """Basic Exception in Brain"""
from typing import Any
from Brain.src.common.http_response_codes import responses
class BrainException(Exception):
JSON_PARSING_ISSUE_MSG = "Exception occurred in json paring."
def __init__(self, message: str = "Exception occurred in brain", code: int = 506):
self.message = message
self.code = code
super().__init__(self.message)
def get_response_exp(self) -> Any:
responses[self.code] = ("Brain Exception", self.message)
return {"message": responses[self.code], "result": "", "status_code": self.code}
|