Skip to main content

Welcome

PyPI version codecov FOSSA Status

RichErr

RichErr is a tiny module that gives you basic error class, which can be used in JSON, dict, list, and other mutation

from richerr import RichErr

print(RichErr.convert(ValueError('Hello world!')).json(indent=2))
{
  "error": {
    "code": 400,
    "exception": "BadRequest",
    "message": "Hello world!",
    "caused_by": {
      "error": {
        "code": 500,
        "exception": "ValueError",
        "message": "Hello world!",
        "caused_by": null
      }
    }
  }
}

Installation

Poetry

poetry add RichErr

PIP

pip install RichErr

Requirements

  • Python 3.12+
  • No package dependencies

Plugins

  • Supported Django Validation and ObjectNotFound errors
  • Supported DRF Validation errors
  • Supported Pydantic Validation errors

Want to add your own error conversion?

Add direct conversion

from richerr import RichErr, GatewayTimeout


class MyTimeoutError(IOError): ...


RichErr.add_conversion(MyTimeoutError, GatewayTimeout)

Or add conversion method

from richerr import RichErr


class MyTimeoutError(IOError): ...


def _convert(err: MyTimeoutError):
    return RichErr.from_error(err, message='Something happened', code=500, name='MyTimeoutError')


RichErr.add_conversion(MyTimeoutError, _convert)

!!! Subclasses will be checked before their parent, if multiple classes in same MRO will be registered. !!!

FOSSA Status

Metadata

Release files for RichErr 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for RichErr 0.3.0
File Size Uploaded Provenance Actions
richerr-0.3.0.tar.gz 5.6 kB Without provenance Details for richerr-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for RichErr 0.3.0
File Interpreter ABI Platform Actions
richerr-0.3.0-py3-none-any.whl Python 3 none any Details for richerr-0.3.0-py3-none-any.whl

Total release size: 11.5 kB

Release files / richerr-0.3.0.tar.gz

Download URL richerr-0.3.0.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a019461a1ed1e3698d74850bcac181d354b62cb5cb1db1485b641c2d02602088
BLAKE2b-256 checksum
How to use checksums
cffff8effcdc286c3b6c0c761324c5f7ae33eca9b70ed26a87d78e783619dc22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.12.0 Linux/6.2.0-1014-azure

Release files / richerr-0.3.0-py3-none-any.whl

Download URL richerr-0.3.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2282dacf296361b9edd0a8e84611cdd692de6f4cbe681189fbed419e06997e25
BLAKE2b-256 checksum
How to use checksums
17f1d2e64e1b4c788d4dcb08925183a0d7155352bc5639e6775ae9a4bf1d42cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.12.0 Linux/6.2.0-1014-azure

Security for RichErr 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page