a3exception


توضیحات

a3exception is a package for unifying exceptions during front-end and back-end communication.
ویژگی مقدار
سیستم عامل OS Independent
نام فایل a3exception-0.3.0
نام a3exception
نسخه کتابخانه 0.3.0
نگهدارنده []
ایمیل نگهدارنده []
نویسنده -
ایمیل نویسنده three-kinds <3179158552@qq.com>
آدرس صفحه اصلی -
آدرس اینترنتی https://pypi.org/project/a3exception/
مجوز MIT
# a3exception English | [简体中文](README_ZH.md) `a3exception` is a package for unifying exceptions during front-end and back-end communication. ## 1. Introduction ### errors * Base exception: Error * Predefined client exceptions: ValidationError, NotFoundError ... * Predefined server exceptions: ServerKnownError, ServerUnknownError ### DynamicErrorFactory * Generate a exception dynamically according to the dictionary: build_error_by_status * Add a custom exception: add_custom_error_cls ## 2. Usage ### Install ```shell pip install a3exception ``` ### Examples ```python from a3exception.dynamic_error_factory import DynamicErrorFactory from a3exception.errors import Error class MyError(Error): def __init__(self, message: str, **kwargs): super().__init__(message=message, **kwargs) if __name__ == "__main__": DynamicErrorFactory.add_custom_error_cls(MyError) error_message = "custom error" error = DynamicErrorFactory.build_error_by_status(status=MyError.__name__, message=error_message) assert isinstance(error, MyError) assert error.message == error_message ```


نیازمندی

مقدار نام
- a3py>=0.3.0


زبان مورد نیاز

مقدار نام
>=3.10 Python


نحوه نصب


نصب پکیج whl a3exception-0.3.0:

    pip install a3exception.whl


نصب پکیج tar.gz a3exception-0.3.0:

    pip install a3exception.tar.gz