wag-managment-api-service-v.../ApiLayers/ErrorHandlers/Exceptions/api_exc.py

19 lines
607 B
Python

from Services.Redis.Actions.actions import RedisActions
class HTTPExceptionApi(Exception):
def __init__(self, error_code: str, lang: str, loc: str = "", sys_msg: str = ""):
self.error_code = error_code
self.lang = lang
self.loc = loc
self.sys_msg = sys_msg
def retrieve_error_message_by_code_at_redis(self):
"""
Retrieve the error message from the redis by the error code.
"""
error_msg = RedisActions.get_json(list_keys=["LANGUAGE_MODELS", "ERRORCODES", self.lang])
if error_msg.status:
return error_msg.first