From: Simon Glass <sjg@chromium.org>
Date: Sat, 23 Oct 2021 23:26:12 +0000 (-0600)
Subject: test/py: Raise a ValueError if a command fails
X-Git-Tag: v2025.01-rc5-pxa1908~1591^2~18^2
X-Git-Url: http://git.dujemihanovic.xyz/img/html/static/gitweb.css?a=commitdiff_plain;h=452e8c9086a9f95739582da5ccc2130e4bf1ae8b;p=u-boot.git

test/py: Raise a ValueError if a command fails

At present an Exception is raised if a command fails. This is a very broad
class and makes it difficult for callers to catch the error without also
catching other things, like programming bugs.

Change it to ValueError to make this easier.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

diff --git a/test/py/multiplexed_log.py b/test/py/multiplexed_log.py
index 9325fae46d..6688207fb3 100644
--- a/test/py/multiplexed_log.py
+++ b/test/py/multiplexed_log.py
@@ -165,7 +165,7 @@ class RunAndLog(object):
         if output and not output.endswith('\n'):
             output += '\n'
         if exit_status and not exception and not ignore_errors:
-            exception = Exception('Exit code: ' + str(exit_status))
+            exception = ValueError('Exit code: ' + str(exit_status))
         if exception:
             output += str(exception) + '\n'
         self.logfile.write(self, output)