Skip to content

Commit

Permalink
More explicit handling of response that are not "ok". More closely fo…
Browse files Browse the repository at this point in the history
…llows the Rust API of Zenoh.
  • Loading branch information
freol35241 committed Feb 7, 2024
1 parent 4d7a5e2 commit 185f89a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def read(fname):

setup(
name="zenoh-cli",
version="0.3.2",
version="0.3.3",
license="Apache License 2.0",
description="CLI for Zenoh",
long_description=read("README.md"),
Expand Down
8 changes: 4 additions & 4 deletions zenoh_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ def get(
session: zenoh.Session, parser: argparse.ArgumentParser, args: argparse.Namespace
):
for response in session.get(args.selector, zenoh.Queue()):
try:
if response.is_ok:
reply = response.ok
_print_sample_to_stdout(reply, args.line, args.decoder)
except Exception:
else:
logger.error(
"Received error (%s) on get(%s)",
reply.err.payload.decode(),
Expand Down Expand Up @@ -147,7 +147,7 @@ def network(
graph = nx.Graph()

for response in session.get("@/router/*", zenoh.Queue()):
try:
if response.is_ok:
reply = response.ok
data = json.loads(reply.payload)

Expand All @@ -162,7 +162,7 @@ def network(
graph.add_node(peer, whatami=whatami)
graph.add_edge(zid, peer, protocol=link_protocols)

except Exception:
else:
logger.error(
"Received error (%s) on get(%s)",
reply.err.payload.decode(),
Expand Down

0 comments on commit 185f89a

Please sign in to comment.