Catalog PyPI
PACKAGE EXPLORERView in registry

a3exception

PyPI

a3exception is a package for unifying exceptions during front-end and back-end communication.

Versions collected1
Direct dependencies1From release 0.3.0
Last observed20 Oct, 16:39 UTC

README

Version 0.3.0 documentation

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

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.3.010 Mar 20251

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
three-kinds/a3exception

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 16:39 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:c04c2d553543152cddef6be779ad12a5d3c0b49c58006344dc31df8a219a26a0