[PATCH v2 18/41] test/py: Raise a ValueError if a command fails

Simon Glass sjg at chromium.org
Sun Oct 24 01:26:12 CEST 2021


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 at chromium.org>
---

(no changes since v1)

 test/py/multiplexed_log.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/py/multiplexed_log.py b/test/py/multiplexed_log.py
index 9325fae46d2..6688207fb31 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)
-- 
2.33.0.1079.g6e70778dc9-goog



More information about the U-Boot mailing list