Skip to content

Commit

Permalink
Logging exception
Browse files Browse the repository at this point in the history
  • Loading branch information
yufengwangca committed Dec 13, 2022
1 parent e313643 commit bd5e4c0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
5 changes: 3 additions & 2 deletions scripts/tests/java/commissioning_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,6 @@ def RunTest(self):
if self.command_name == 'onnetwork-long':
code = self.TestCmdOnnetworkLong(self.nodeid, self.setup_payload, self.discriminator, self.timeout)
if code != 0:
logging.error(f"Testing onnetwork-long pairing failed with error {code}")
raise Exception("Failed to pair onnetwork device")
raise Exception(f"Testing onnetwork-long pairing failed with error {code}")
else:
raise Exception(f"Unsupported command {self.command_name}")
5 changes: 3 additions & 2 deletions scripts/tests/java/discover_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,6 @@ def RunTest(self):
if self.command_name == 'commissionables':
code = self.TestCmdCommissionables()
if code != 0:
logging.error(f"Testing command commissionables failed with error {code}")
raise Exception("Failed to discover commissionables devices")
raise Exception(f"Testing command commissionables failed with error {code}")
else:
raise Exception(f"Unsupported command {self.command_name}")
6 changes: 4 additions & 2 deletions scripts/tests/run_java_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,17 @@ def main(app: str, app_args: str, tool_path: str, tool_cluster: str, tool_args:
test = CommissioningTest(log_cooking_threads, log_queue, command, tool_args)
try:
test.RunTest()
except Exception:
except Exception as e:
logging.error(e)
sys.exit(1)
elif tool_cluster == 'discover':
logging.info("Testing discover cluster")

test = DiscoverTest(log_cooking_threads, log_queue, command, tool_args)
try:
test.RunTest()
except Exception:
except Exception as e:
logging.error(e)
sys.exit(1)

app_exit_code = 0
Expand Down

0 comments on commit bd5e4c0

Please sign in to comment.