Skip to content

Commit

Permalink
Merge pull request #21 from MO-RISE/fix/handling-of-non-ok-answers
Browse files Browse the repository at this point in the history
More explicit handling of response that are not "ok". More closely fo…
  • Loading branch information
freol35241 authored Feb 7, 2024
2 parents 4d7a5e2 + 185f89a commit bc009a8
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 bc009a8

Please sign in to comment.