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.5.tar.gz (4.8 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.5-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: static_error_handler-0.1.5.tar.gz
  • Upload date:
  • Size: 4.8 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.5.tar.gz
Algorithm Hash digest
SHA256 c7094f943100e3f1acc55a08dc63b40d12977effae8fe8fc4cf4efd1a8172ff7
MD5 409aae26ea38f046b864e57833de1c26
BLAKE2b-256 6e4e8fd547385ddad5df7d5d19e169d680a500b08af54aa486909e2270d37ee9

See more details on using hashes here.

Provenance

The following attestation bundles were made for static_error_handler-0.1.5.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.5-py3-none-any.whl.

File metadata

File hashes

Hashes for static_error_handler-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a933ad3d83880dc53c22b20e637e53f688a6f78e21ddc1cbb3001ebbe324c7bc
MD5 07898577ba69b9b48a2a9a6aaf50f337
BLAKE2b-256 ffa5e9d3e9136fd469b09c5de297eeab5c4e75d1c44a50aec71030a32fbaa566

See more details on using hashes here.

Provenance

The following attestation bundles were made for static_error_handler-0.1.5-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