Implemented multi-error handling in MultiError() class (#614)

* Implemented multi-error handling in MultiError() class

* Added newsfragement file and test

* updated doc-string and list-struct

* updating docstring
This commit is contained in:
Saksham Chauhan
2025-05-23 02:52:38 +05:30
committed by GitHub
parent 4b1860766d
commit 276b9b7339
3 changed files with 53 additions and 2 deletions

View File

@ -0,0 +1,13 @@
from libp2p.exceptions import (
MultiError,
)
def test_multierror_str_and_storage():
errors = [ValueError("bad value"), KeyError("missing key"), "custom error"]
multi_error = MultiError(errors)
# Check for storage
assert multi_error.errors == errors
# Check for representation
expected = "Error 1: bad value\n" "Error 2: 'missing key'\n" "Error 3: custom error"
assert str(multi_error) == expected