Skip to main content

A minimal Python adaptation of Rust's Result type

Project description

static_error_handler

A minimal Python adaptation of Rust's Result type. Provides Ok and Err classes with helper methods for error handling.

Installation

Once published on PyPI you can install the library with:

pip install static_error_handler

Usage

from static_error_handler import Ok, Err, Result

def divide(a: int, b: int) -> Result[int, str]:
    if b == 0:
        return Err("division by zero")
    return Ok(a // b)

result = divide(10, 2)
print(result.unwrap())  # 5

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

static_error_handler-0.1.3.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

static_error_handler-0.1.3-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file static_error_handler-0.1.3.tar.gz.

File metadata

  • Download URL: static_error_handler-0.1.3.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for static_error_handler-0.1.3.tar.gz
Algorithm Hash digest
SHA256 33485a0fe0ee534070d0208d5ff8fc5fd55b394e68d8447028b63304c7771033
MD5 d142af8b1a855c3518a79edb2e7aaae6
BLAKE2b-256 c00ba17ef8e0f774bd149038a3464f8c7566280d54ddd7658175c7c03f52f62b

See more details on using hashes here.

Provenance

The following attestation bundles were made for static_error_handler-0.1.3.tar.gz:

Publisher: python-publish.yml on J-joon/static_error_handler

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file static_error_handler-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for static_error_handler-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 feff613d06b79e31784c5afa47e5fe520571594e05ce0ae4390cc88b984eb6f3
MD5 17d4594b9a1647da63df93ba2725b728
BLAKE2b-256 4928c1263e82c41ee69e0e6d3f85697cd5dd7b8166bfbeb602ce80f21fe7c757

See more details on using hashes here.

Provenance

The following attestation bundles were made for static_error_handler-0.1.3-py3-none-any.whl:

Publisher: python-publish.yml on J-joon/static_error_handler

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page