a3exception
English | 简体中文
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
pip install a3exception
Examples
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
Metadata
Release files for a3exception 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| a3exception-0.3.0.tar.gz | 4.3 kB | Without provenance | Details for a3exception-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| a3exception-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for a3exception-0.3.0-py3-none-any.whl |
Total release size: 8.5 kB
Release files / a3exception-0.3.0.tar.gz
| Download URL | a3exception-0.3.0.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
90a1e15bda0523ff87412adcfd396cf6c97136792042d910f06cac5b65591d0c
|
|
BLAKE2b-256 checksum How to use checksums |
99287ba73997615e3102891b905d5bbd3e9b9c665500ba6cdc544c42f5d58fdb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.2
|
Release files / a3exception-0.3.0-py3-none-any.whl
| Download URL | a3exception-0.3.0-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
60ac7d0db1c7275b83a9f54204874a8ebd1f16cf3d8ea67332862ee9f782deb4
|
|
BLAKE2b-256 checksum How to use checksums |
c22f31d52fcad65201b36aaa077bf9be5e8ce4e1fee8a8646c8f1afe72c5de39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.2
|
Security for a3exception 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.