Difficult-Rocket/Difficult_Rocket/exception/language.py
2023-12-03 16:54:07 +08:00

38 lines
900 B
Python

# -------------------------------
# Difficult Rocket
# Copyright © 2020-2023 by shenjackyuanjie 3695888@qq.com
# All rights reserved
# -------------------------------
from Difficult_Rocket.exception import BaseError
__all__ = [
"LanguageNotFound",
"TranslateError",
"TranslateKeyNotFound",
"TranslateFileError",
]
class LanguageNotFound(BaseError):
"""语言文件缺失"""
class TranslateError(BaseError):
"""翻译相关问题"""
class TranslateKeyNotFound(TranslateError):
"""语言文件某项缺失"""
def __init__(self, value: dict = None, item_names: list = None):
self.item_names: list = item_names
self.value: dict = value
def __str__(self):
return f"{self.__class__.__name__}: Can't get item {'. '.join(self.item_names)} from: {self.value}"
class TranslateFileError(TranslateError):
"""翻译文件错误"""