Skip to content

Commit 4a0d559

Browse files
committed
fix: correct readme.md badge url
1 parent 103025d commit 4a0d559

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# ResultContainer: Rust Result Enums in Python
22

33
<p align="left">
4-
<img src="https://github.com/ScottBoyce-Python/ResultContainer/actions/workflows/python-pytest.yml/badge.svg" alt="Build Status" height="20">
4+
<img src="https://github.com/ScottBoyce-Python/ResultContainer/actions/workflows/ResultContainer-pytest.yml/badge.svg" alt="Build Status" height="20">
55
</p>
66

77

8+
89
The `ResultContainer` module simplifies complex error handling into clean, readable, and maintainable code structures. Error handling in Python can often become unwieldy, with deeply nested `try/except` blocks and scattered error management. The `ResultContainer` is used for situations when errors are expected and are easily handled. Inspired by [Rust’s Result<Ok, Err>](https://doc.rust-lang.org/std/result/enum.Result.html) enum, `ResultContainer` introduces a clean and Pythonic way to encapsulate success (`Ok`) and failure (`Err`) outcomes.
910

1011
The `ResultContainer.Result` enum wraps a value in an `Ok` variant, until there is an exception or error raised, and then it is converted to the `Err` variant. The `Err` variant wraps a `ResultContainer.ResultErr` object that contains the error messages and traceback information. The `Result` object includes similar methods to the Rust Result Enum for inquiry about the state, mapping functions, and passing attributes/methods to the containing `value`.
@@ -88,6 +89,7 @@ There are methods built into `Result` to check if an error has been raised, or t
8889

8990
```python
9091
# Only the first argument is required for all constructors
92+
from ResultContainer import Result, Ok, Err
9193

9294
# Main object signature:
9395
res = Result(value, success, error_msg, error_code, error_code_group, add_traceback, deepcopy) # Construct either Ok or Er
@@ -184,6 +186,7 @@ z = x + y # z = Ok([1, 2, 3, 4, 5, 6, 7])
184186
### Wrapping Objects
185187

186188
```python
189+
from ResultContainer import Result, Ok, Err
187190
from datetime import datetime, timedelta
188191

189192
# Wrap a datetime.datetime object
@@ -259,6 +262,7 @@ y = x.raises() # Raises the following exception:
259262
### Passing Functions and Chaining Operations
260263

261264
```python
265+
from ResultContainer import Result, Ok, Err
262266
from math import sqrt
263267
# to use an external function, like sqrt
264268
# It must be passed to either apply or map or extracted with expect.

0 commit comments

Comments
 (0)