nats-io / nats.py

Python3 client for NATS
https://nats-io.github.io/nats.py/
Apache License 2.0
902 stars 193 forks source link

ObjectStore.list() should not raise NotFoundError if no objects found #586

Open skewty opened 4 months ago

skewty commented 4 months ago

Observed behavior

NotFoundError is raised. This exception is unexpected (not mentioned in docstring) and non-pythonic.

Expected behavior

Empty list is returned. This meets the contract of the docstring and method signature and is pythonic.

Server and client version

nats-py 2.8.0

nats-server 2.10.17

Host environment

No response

Steps to reproduce

No response

skewty commented 3 months ago

@caspervonb the current behavior seems intentional. Would adding a raise_on_empty: bool = True kwarg be an acceptable "fix" as changing this would be a breaking change. Should this be deferred to a v3 release?